Method: JSON::Schema::RefAttribute.validate

Defined in:
lib/json-schema/attributes/ref.rb

.validate(current_schema, data, fragments, processor, validator, options = {}) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/json-schema/attributes/ref.rb', line 4

def self.validate(current_schema, data, fragments, processor, validator, options = {})
  uri,schema = get_referenced_uri_and_schema(current_schema.schema, current_schema, validator)

  if schema
    schema.validate(data, fragments, processor, options)
  elsif uri
    message = "The referenced schema '#{uri.to_s}' cannot be found"
    validation_error(processor, message, fragments, current_schema, self, options[:record_errors])
  else
    message = "The property '#{build_fragment(fragments)}' was not a valid schema"
    validation_error(processor, message, fragments, current_schema, self, options[:record_errors])
  end
end