Module: JSI::Schema::SchemaAncestorNode
- Included in:
- Base, MetaSchemaNode::BootstrapSchema
- Defined in:
- lib/jsi/schema/schema_ancestor_node.rb
Overview
a node in a document which may contain a schema somewhere within is extended with SchemaAncestorNode, for tracking things necessary for a schema to function correctly
Instance Attribute Summary collapse
-
#jsi_base_uri ⇒ URI?
readonly
Base URI for URI resolution - always an absolute URI (with no fragment).
- #jsi_schema_dynamic_anchor_map ⇒ Schema::DynamicAnchorMap readonly private
-
#jsi_schema_resource_ancestors ⇒ Array<JSI::Schema>
readonly
private
resources which are ancestors of this JSI in the document.
Instance Method Summary collapse
- #initialize ⇒ Object
-
#jsi_anchor_subschemas(anchor) ⇒ Set<JSI::Schema>
All schemas at or below this node with the given anchor.
- #jsi_is_resource_root? ⇒ Boolean
-
#jsi_next_base_uri ⇒ URI?
URI for resolution of relative URIs at or below this node - always an absolute URI (with no fragment).
- #jsi_resource_root ⇒ Schema::SchemaAncestorNode?
-
#jsi_resource_uri ⇒ URI?
An absolute URI identifying this node, if this node is a resource root.
-
#jsi_resource_uris ⇒ Enumerable<URI>
Absolute URIs identifying this node - typically one URI if this is a resource root, otherwise none.
-
#jsi_schema_base_uri ⇒ Object
deprecated
Deprecated.
after v0.8
-
#jsi_schema_registry ⇒ Object
deprecated
Deprecated.
after v0.8
Instance Attribute Details
#jsi_base_uri ⇒ URI?
Base URI for URI resolution - always an absolute URI (with no fragment).
If this node is a resource, its #jsi_resource_uri (i.e. its $id) is resolved against this URI, if that is relative.
At the root this comes from param base_uri of new_jsi/new_schema,
or from a configured root_uri.
Below the root this comes from the parent's #jsi_next_base_uri.
26 27 28 |
# File 'lib/jsi/schema/schema_ancestor_node.rb', line 26 def jsi_base_uri @jsi_base_uri end |
#jsi_schema_dynamic_anchor_map ⇒ Schema::DynamicAnchorMap
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
40 41 42 |
# File 'lib/jsi/schema/schema_ancestor_node.rb', line 40 def jsi_schema_dynamic_anchor_map @jsi_schema_dynamic_anchor_map end |
#jsi_schema_resource_ancestors ⇒ Array<JSI::Schema>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
resources which are ancestors of this JSI in the document. this does not include self.
36 37 38 |
# File 'lib/jsi/schema/schema_ancestor_node.rb', line 36 def jsi_schema_resource_ancestors @jsi_schema_resource_ancestors end |
Instance Method Details
#initialize ⇒ Object
8 9 10 11 |
# File 'lib/jsi/schema/schema_ancestor_node.rb', line 8 def initialize(*) super jsi_schema_ancestor_node_initialize end |
#jsi_anchor_subschemas(anchor) ⇒ Set<JSI::Schema>
All schemas at or below this node with the given anchor.
112 113 114 |
# File 'lib/jsi/schema/schema_ancestor_node.rb', line 112 def jsi_anchor_subschemas(anchor) @anchor_subschemas_map[anchor: anchor, content: jsi_node_content] end |
#jsi_is_resource_root? ⇒ Boolean
55 56 57 58 |
# File 'lib/jsi/schema/schema_ancestor_node.rb', line 55 def jsi_is_resource_root? # overridden by Schema jsi_ptr.root? end |
#jsi_next_base_uri ⇒ URI?
URI for resolution of relative URIs at or below this node - always an absolute URI (with no fragment).
Mainly used to resolve relative $refs.
This is self's #jsi_resource_uri if this node is a resource; otherwise #jsi_base_uri.
82 83 84 |
# File 'lib/jsi/schema/schema_ancestor_node.rb', line 82 def jsi_next_base_uri jsi_resource_uri || jsi_base_uri end |
#jsi_resource_root ⇒ Schema::SchemaAncestorNode?
49 50 51 52 |
# File 'lib/jsi/schema/schema_ancestor_node.rb', line 49 def jsi_resource_root # overridden by Base. may be nil from MetaSchemaNode::BootstrapSchema. jsi_is_resource_root? ? self : jsi_schema_resource_ancestors.last end |
#jsi_resource_uri ⇒ URI?
An absolute URI identifying this node, if this node is a resource root.
Typically from a schema's $id keyword.
63 64 65 |
# File 'lib/jsi/schema/schema_ancestor_node.rb', line 63 def jsi_resource_uri jsi_resource_uris.first end |
#jsi_resource_uris ⇒ Enumerable<URI>
Absolute URIs identifying this node - typically one URI if this is a resource root, otherwise none.
69 70 71 |
# File 'lib/jsi/schema/schema_ancestor_node.rb', line 69 def jsi_resource_uris @resource_uris_map[content: jsi_node_content] end |
#jsi_schema_base_uri ⇒ Object
after v0.8
29 30 31 |
# File 'lib/jsi/schema/schema_ancestor_node.rb', line 29 def jsi_schema_base_uri jsi_base_uri end |
#jsi_schema_registry ⇒ Object
after v0.8
43 44 45 |
# File 'lib/jsi/schema/schema_ancestor_node.rb', line 43 def jsi_schema_registry jsi_registry end |