class ViewModel::Schemas
def self.verify_schema!(schema, value)
def self.verify_schema!(schema, value) valid, errors = schema.validate(value) unless valid error_list = errors.map { |e| "#{e.pointer}: #{e.message}" }.join("\n") errors = 'Error'.pluralize(errors.length) raise ViewModel::DeserializationError::InvalidSyntax.new("#{errors} parsing #{schema.description}:\n#{error_list}") end end