Module: JSI::DescribesSchemaModule

Defined in:
lib/jsi/schema_classes.rb

Overview

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

Instance Method Summary collapse

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.


45
46
47
# File 'lib/jsi/schema_classes.rb', line 45

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:


55
56
57
# File 'lib/jsi/schema_classes.rb', line 55

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