Module that analyzes and resolves JSON Schema in-place applicators.
In this approach, the in-place applicators present in a JSON Schema are modeled as a directed tree (where nodes represented by module:inPlaceApplicators~IPASchema objects). Each node stores the keywords belonging to its corresponding subschema: hence, any possible materialization of a JSON Schema can be reconstructed by aggregating the keywords of each node traversed by any directed path from the root node to the leaf.
The user is intended to select the desired path: module:selectors provides a user interface for this purpose.
Classes
Methods
(inner) aggregate(schema, …ipaSchemas) → {object}
Aggregates the keywords of a JSON Schema with the common keywords from a list of in-place application nodes.
Collisions are resolved applying the logic implemented by the module:inPlaceApplicators~Aggregation class.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
schema |
object | The JSON Schema to aggregate. |
|
ipaSchemas |
module:inPlaceApplicators~IPASchema |
<repeatable> |
The in-place application nodes whose common keywords are to be aggregated. |
Returns:
The aggregated JSON Schema.
- Type
- object
(inner) process(schema, pointeropt, selectedopt) → {module:inPlaceApplicators~IPASchema}
Processes a JSON Schema, generating an in-place application tree that represents its possible materializations.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
schema |
object | The JSON Schema to process. |
||
pointer |
string |
<optional> |
'' | A JSON Pointer that provides unique identification to each in-place applicator in the JSON Schema. |
selected |
number |
<optional> |
0 | The index indicating the applicator subschema to be selected at initialization. |
Returns:
The root node to the in-place application tree that represents the given JSON Schema.
(inner) processAllOf(schema, pointeropt) → {module:inPlaceApplicators~ProcessAllOfResult}
Processes an allOf
in-place applicator.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
schema |
object | The JSON Schema including an |
||
pointer |
string |
<optional> |
'' | A JSON Pointer that identifies the JSON Schema. |
Returns:
The result of
processing the allOf
in-place applicator.
(inner) processAnyOf(subschemas, pointeropt) → {Array.<module:inPlaceApplicators~IPASchema>}
Processes an anyOf
in-place applicator.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
subschemas |
Array.<object> | The subschemas included in the |
||
pointer |
string |
<optional> |
'' | A JSON Pointer that identifies the JSON Schema. |
Returns:
An array of nodes
representing each subschema contained by the anyOf
applicator.
- Type
- Array.<module:inPlaceApplicators~IPASchema>
(inner) processDisjunctiveInPlaceApplicator(subschemas, pointeropt) → {Array.<module:inPlaceApplicators~IPASchema>}
Processes a disjunctive in-place applicator.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
subschemas |
Array.<object> | The subschemas included in the disjunctive in-place applicator. |
||
pointer |
string |
<optional> |
'' | A JSON Pointer that identifies the JSON Schema. |
Returns:
An array of nodes representing each subschema contained by the applicator.
- Type
- Array.<module:inPlaceApplicators~IPASchema>
(inner) processOneOf(subschemas, pointeropt) → {Array.<module:inPlaceApplicators~IPASchema>}
Processes an oneOf
in-place applicator.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
subschemas |
Array.<object> | The subschemas included in the |
||
pointer |
string |
<optional> |
'' | A JSON Pointer that identifies the JSON Schema. |
Returns:
An array of nodes
representing each subschema contained by the oneOf
applicator.
- Type
- Array.<module:inPlaceApplicators~IPASchema>
Type Definitions
ProcessAllOfResult
Type:
- object
Properties:
Name | Type | Description |
---|---|---|
common |
object | The keywords that are common to all the |
applicatorByPointer |
Map.<string, module:inPlaceApplicators~InPlaceApplicator> | A map including the child in-place applicators contained by the processed
|