The Trellis core library supports the trellis-cli
and trellis-ui
projects by wrapping the handlebars and JSON Schema $Ref Parser projects to extend and abstract for use in the modeling framework.
NOTE: Node.js
^18.0.0
is required to run tests.
Exports of this module that abstract & extend JSON Schema $Ref Parser.
Syntax: preprocessModel(model: string | $RefParser.JSONSchema, preprocessFn?: (model: $RefParser.JSONSchema) => $RefParser.JSONSchema)
Calls $RefParser.parse(model)
and then preprocessFn(model)
on the model to enrich it with additional metadata set by the preprocessing script.
Syntax: postprocessModel(model: string | $RefParser.JSONSchema, preprocessFn: (model: $RefParser.JSONSchema) => $RefParser.JSONSchema)
Calls $RefParser.dereference(model)
and then preprocessFn(model)
on the model to enrich it with additional metadata set by the postprocessing script.
Exports of this module that abstract & extend handlebars.
Syntax: registerPartials(partials: PartialTemplate[])
Used to register partials that are referenced in templates prior to compiling and using templates.
Syntax: compileTemplate(template: string)
Compiles into a
Alias for Array.includes()
.
Syntax: {{#includes collection: any[] item: any}}
Alias for conditional test.
Syntax: {{#ifCond a: any logicalOperator: string b: any}}
The following operators are supported:
===
(==
can be used but evaluates as===
)!==
(!=
can be used but evaluates as!==
)<
>
<=
>=
&&
||