Method: JSON::Validator#handle_schema

Defined in:
lib/json-schema/validator.rb

#handle_schema(parent_schema, obj) ⇒ Object

Either load a reference schema or create a new schema



353
354
355
356
357
358
359
360
361
362
# File 'lib/json-schema/validator.rb', line 353

def handle_schema(parent_schema, obj)
  if obj.is_a?(Hash)
    schema_uri = parent_schema.uri.clone
    schema = JSON::Schema.new(obj,schema_uri,parent_schema.validator)
    if obj['id']
      Validator.add_schema(schema)
    end
    build_schemas(schema)
  end
end