Module: JSI::DescribesSchemaModule

Included in:
JSONSchemaOrgDraft04, JSONSchemaOrgDraft06, JSONSchemaOrgDraft07
Defined in:
lib/jsi/schema_classes.rb

Overview

a module to extend the JSI Schema Module of a schema which describes other schemas

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#schema_implementation_modulesSet<Module> (readonly)

Returns:

  • (Set<Module>)


62
63
64
# File 'lib/jsi/schema_classes.rb', line 62

def schema_implementation_modules
  @schema_implementation_modules
end

Instance Method Details

#new_schema(schema_content, **kw) ⇒ JSI::Base, JSI::Schema

instantiates the given schema content as a JSI Schema.

see Schema::DescribesSchema#new_schema

Parameters:

  • schema_content (#to_hash, Boolean)

    an object to be instantiated as a schema

  • uri (nil, #to_str, Addressable::URI)

    the URI of the schema document. relative URIs within the document are resolved using this uri as their base. the result schema will be registered with this URI in the JSI.schema_registry.

Returns:

  • (JSI::Base, JSI::Schema)

    a JSI whose instance is the given schema_content and whose schemas consist of this module's schema.



47
48
49
# File 'lib/jsi/schema_classes.rb', line 47

def new_schema(schema_content, **kw)
  schema.new_schema(schema_content, **kw)
end

#new_schema_module(schema_content, **kw) ⇒ Module, JSI::SchemaModule

instantiates a given schema object as a JSI Schema and returns its JSI Schema Module.

shortcut to chain Schema::DescribesSchema#new_schema + Schema#jsi_schema_module.

Parameters:

  • schema_content (#to_hash, Boolean)

    an object to be instantiated as a schema

  • uri (nil, #to_str, Addressable::URI)

    the URI of the schema document. relative URIs within the document are resolved using this uri as their base. the result schema will be registered with this URI in the JSI.schema_registry.

Returns:



57
58
59
# File 'lib/jsi/schema_classes.rb', line 57

def new_schema_module(schema_content, **kw)
  schema.new_schema(schema_content, **kw).jsi_schema_module
end