Normalizes the schema nodes a catalog's validation schema is assembled from, as the reference catalog does before bundling common types:
- a
titlekeyword is dropped unless it was marked as authored (mark_titles/1); default: nullanditems: {}are dropped;nullbranches leave unions, and a union with one branch left becomes that branch;- an inline dynamic value union (a literal, a
DataBindingand aFunctionCallbranch) becomes a$refto the common type it matches (DynamicString,DynamicStringList,DynamicValue, …); anyOfbecomesoneOf, except underadditionalPropertiesand where a branch only constrains (requiredwithouttype).
clean/2 also reports the #/$defs/… names the result references.
Summary
Types
The dynamic value defs of a common types document, by the literal branches of their unions.
Functions
Cleans node (see the module doc) with the dynamic value index,
returning the cleaned node and the #/$defs/… names it references.
Builds the dynamic value index of a $defs map: every def whose union
has a DataBinding branch, a FunctionCall branch and literal
branches.
Marks the title keywords of an authored schema so clean/2 keeps
them. A property named title and the values of data keywords
(const, default, enum, examples) are left alone.
Types
Functions
Cleans node (see the module doc) with the dynamic value index,
returning the cleaned node and the #/$defs/… names it references.
Builds the dynamic value index of a $defs map: every def whose union
has a DataBinding branch, a FunctionCall branch and literal
branches.
Marks the title keywords of an authored schema so clean/2 keeps
them. A property named title and the values of data keywords
(const, default, enum, examples) are left alone.