Class: JSONSkooma::Keywords::Core::Schema

Inherits:
Base
  • Object
show all
Defined in:
lib/json_skooma/keywords/core/schema.rb

Instance Attribute Summary

Attributes inherited from Base

#json, #parent_schema

Instance Method Summary collapse

Methods inherited from Base

#each_schema, #evaluate, inherited, #instance_types, #key, #resolve, set_defaults, #static, value_schema=

Constructor Details

#initialize(parent_schema, value) ⇒ Schema

Returns a new instance of Schema.



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/json_skooma/keywords/core/schema.rb', line 10

def initialize(parent_schema, value)
  super

  # todo: validate URI.validate(require_scheme=True, require_normalized=True)
  uri = URI.parse(value)
  parent_schema.metaschema_uri = uri

  if parent_schema.is_a?(Metaschema)
    metaschema = parent_schema.registry.metaschema(uri)
    parent_schema.core_vocabulary ||= metaschema.core_vocabulary
    parent_schema.default_vocabularies ||= metaschema.default_vocabularies
  end
end