$ref handling for catalog documents.
A catalog document references three kinds of target:
- the protocol's common types, as
common_types.json#/$defs/X(or a path ending in/common_types.json); - its own definitions, as
#/…or through a document namedcatalog.json; - a peer catalog it holds, as
<peer document>#/components/…or#/functions/…, where the document names the peer bycatalogIdor$id, exactly or by path suffix, before falling back to the file name (protocol guide, "Cross-Catalog References").
normalize/2 rewrites references into the common types and into the
catalog itself as local #/$defs/… pointers; inline/4 writes local
and peer references inline, keeping references to common types.
query/2, inline/4 and strip_envelope/1 also read documents whose
objects are Jason.OrderedObjects, and keep their key order.
Summary
Functions
Whether any $ref in node may point into a peer catalog: one with a
document part other than the common types or catalog.json.
The names of the $defs that local #/$defs/… references in node
target (the first segment after #/$defs/).
Points local references to the names in common_names at the common
types document document (#/$defs/X becomes <document>#/$defs/X).
The peer a $ref document names, or nil. Common types and a document
named exactly catalog.json never name a peer; a path ending in
/catalog.json names one only by id. Otherwise ids are matched first
(exactly or by path suffix), then file names; the first match in
peers order wins.
Writes the local and peer references of node inline.
Rewrites a cross-document $defs reference as a local pointer: one
into the common types, into a document named catalog.json, or into a
path ending in /catalog.json that names none of peers. Any other
reference is returned unchanged.
Whether the document part of a $ref is the file name or a path
ending in it.
Applies localize/2 to every $ref in node.
The $defs name a reference into the same catalog targets: a local
#/$defs/X, or a pointer into a catalog.json document.
Like def_refs/1, also counting references into a catalog.json
document, which a catalog uses for its own definitions.
The node a #/… JSON pointer addresses in document, or nil.
The names in defs that roots reference, transitively (counting
references into catalog.json).
Removes a component's envelope (id, component and catalogId
properties and required names) and closure keywords, recursively
through allOf, where the members that declare component move
first.
Types
Functions
Whether any $ref in node may point into a peer catalog: one with a
document part other than the common types or catalog.json.
The names of the $defs that local #/$defs/… references in node
target (the first segment after #/$defs/).
Points local references to the names in common_names at the common
types document document (#/$defs/X becomes <document>#/$defs/X).
The peer a $ref document names, or nil. Common types and a document
named exactly catalog.json never name a peer; a path ending in
/catalog.json names one only by id. Otherwise ids are matched first
(exactly or by path suffix), then file names; the first match in
peers order wins.
Writes the local and peer references of node inline.
A #/… reference is replaced by its target in root, with the keys
beside the $ref merged over it; a reference into a peer (see
find_peer/2) by its target in the peer's document, whose own local
references resolve against that document. A reference to a name in
preserved (the common types) stays, and so does a reference that is
already being expanded or whose target is missing. A whole component
inherited through #/components/<Name> loses its envelope (id,
component, catalogId) and closure keywords.
Rewrites a cross-document $defs reference as a local pointer: one
into the common types, into a document named catalog.json, or into a
path ending in /catalog.json that names none of peers. Any other
reference is returned unchanged.
Whether the document part of a $ref is the file name or a path
ending in it.
Applies localize/2 to every $ref in node.
The $defs name a reference into the same catalog targets: a local
#/$defs/X, or a pointer into a catalog.json document.
Like def_refs/1, also counting references into a catalog.json
document, which a catalog uses for its own definitions.
The node a #/… JSON pointer addresses in document, or nil.
The names in defs that roots reference, transitively (counting
references into catalog.json).
Removes a component's envelope (id, component and catalogId
properties and required names) and closure keywords, recursively
through allOf, where the members that declare component move
first.