Nunjucks Helpers for Skeleton Entities
Skeleton Entities are rendered with Nunjucks using the ${{ ... }} syntax.
Standard Nunjucks syntax is available in skeleton rendering, including conditions, loops, and built-in filters. This page documents the Witboost-specific helpers available in Skeleton Entities, plus dump because it is the built-in filter used most often in Witboost skeletons.
The helpers documented here are available when Witboost renders:
catalog-info.yamlparameters.yamlexpressions in theparameters,values,readonly, andenvironmentParameterssectionsrefs.<name>.configinparameters.yaml
The variables available in each phase differ. For example, refs are available only when rendering catalog-info.yaml, while refs.<name>.config can use parameters, values, and readonly.
dump
dump is a built-in Nunjucks filter commonly used in Skeleton Entities to serialize a value while preserving its type.
Use it when you want a string, object, array, boolean, number, or map to be emitted as valid YAML.
Input:
- any scalar value, array, or object
Output:
- a serialized representation of that value, suitable for insertion into YAML
Example input:
parameters:
owner: group:finance-data
tags:
- pii
- finance
Example usage:
%SKELETON
kind: Component
spec:
owner: ${{ parameters.owner | dump }}
tags: ${{ parameters.tags | dump }}
Example output:
kind: Component
spec:
owner: group:finance-data
tags:
- pii
- finance
parseEntityRef
parseEntityRef is a filter that parses an entity reference into its structured parts.
Use it when you need to extract the kind, namespace, or name from a Witboost entity reference.
Input:
- a Witboost entity reference string
Output:
- an object with the parsed entity reference parts, including
kind,namespace, andname
Example input:
group:default/finance-data
Example output:
kind: group
namespace: default
name: finance-data
Example usage:
%SKELETON
kind: Component
metadata:
description: Owned by team ${{ (parameters.owner | parseEntityRef).name }}
pick
pick is a filter that extracts a nested field from an object using a dot-separated path.
Use it when an object contains nested data and you want a single field.
Input:
- first argument: an object or array
- second argument: a dot-separated path string such as
spec.owneror@graph.0.@id
Output:
- the value found at that path
nullorundefinedif the path does not resolve to a value in the input object
Example input:
spec:
owner: group:finance-data
mesh:
maturity: strategic
Example output with pick('spec.owner'):
group:finance-data
Example usage:
%SKELETON
kind: Component
spec:
mesh:
maturity: ${{ parameters.metadata | pick('mesh.maturity') }}
parseRdf(...)
parseRdf is a global helper that parses RDF content and returns an object value that can be used in Nunjucks and that follows JSON-LD syntax.
Use it when the skeleton needs to inspect RDF data available in the rendering context.
Input:
- the RDF content as a string
- an optional format string
Supported format strings:
autoturtlen3trigntriplesnquadsrdfxmljsonld
If the format is omitted, the parser tries to auto-detect it from the input content and the optional parsing metadata.
Output:
nullif the input content isnull,undefined, or an empty string- otherwise, an object using JSON-LD syntax, typically containing
@contextand@graph
Example input in Turtle format:
@prefix ex: <http://example.com/> .
ex:Tom a ex:Person ;
ex:name "Tom" .
Example output for Turtle input:
'@context':
ex: http://example.com/
'@graph':
- '@id': ex:Tom
'@type': ex:Person
ex:name: Tom
Example input in RDF/XML format:
<?xml version="1.0"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:ex="http://example.com/">
<rdf:Description rdf:about="http://example.com/Tom">
<rdf:type rdf:resource="http://example.com/Person" />
<ex:name>Tom</ex:name>
</rdf:Description>
</rdf:RDF>
Example output for RDF/XML input:
'@context':
ex: http://example.com/
rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns#
'@graph':
- '@id': ex:Tom
'@type': ex:Person
ex:name: Tom
Example input already written with JSON-LD syntax:
{
"@context": {
"ex": "http://example.com/"
},
"@id": "ex:Tom",
"@type": "ex:Person",
"ex:name": "Tom"
}
Example output for JSON-LD input:
'@context':
ex: http://example.com/
'@graph':
- '@id': ex:Tom
'@type': ex:Person
ex:name: Tom
Example usage in a skeleton:
%SKELETON
kind: Component
metadata:
annotations:
ontology-subject: ${{ parseRdf(parameters.ontology, 'turtle') | pick('@graph.0.@id') }}
Rendered catalog-info.yaml:
metadata:
annotations:
ontology-subject: ex:Tom
Practical Notes
- Use
dumpwhenever you inject arrays, maps, or nested objects into YAML. parseEntityRefandpickare filters, so they are used with the|syntax.parseRdfis a global helper, so it is called like a function.