A2UICore.Catalog.ReferenceMap (A2UICore v0.1.1)

Copy Markdown View Source

Derives, from a catalog's component schemas, which properties are child references — the data A2UICore.Catalog.RefSpec extracts from.

The analysis is a port of the reference analyze_child_ref_schema for JSON Schema components. A property is a single child reference when its schema is (or allOf/anyOf/oneOf-combines) a $ref to ComponentId or Child; a list when it refs ChildList, carries explicitList/template properties, or looks like a componentId + path template. An array whose items are child references is a list, and an array of objects with child-reference properties is a list with nested item keys (tabs[].child).

Local #/… references are followed through the component's own $defs and the enclosing catalog document, with cycle protection. References to other documents (common_types.json#/…) are recognised by name only and not followed.

Summary

Functions

Analyses one component schema. catalog is the enclosing catalog document used to resolve #/… references that leave the component.

Builds %{component_name => RefSpec} for every component of a catalog document (%{"components" => %{name => schema}, "$defs" => …}).

Functions

analyze(schema, catalog \\ nil)

(since 0.1.0)
@spec analyze(term(), map() | nil) :: A2UICore.Catalog.RefSpec.t()

Analyses one component schema. catalog is the enclosing catalog document used to resolve #/… references that leave the component.

build(catalog)

(since 0.1.0)
@spec build(map()) :: %{optional(String.t()) => A2UICore.Catalog.RefSpec.t()}

Builds %{component_name => RefSpec} for every component of a catalog document (%{"components" => %{name => schema}, "$defs" => …}).