JsonataFunctionSpec
Function signature and implementation. params declares the inputs (typed, optionally schema-pinned), returnType declares the output, and body is the JSONata expression that turns one into the other.
Calling the function in JSONata: invoke as $<alias>(arg1, arg2, ...) from any expression that has the function in scope (template data.transform, blueprint inputMap, or another function's body). The alias is the one declared by the caller in its functions[] entry; if no alias is declared, the function's own key is used. Arguments are positional and must match the declared params order and types.
Calling other custom functions from body: declare each callee in the functions[] array with its functionKey + pinned functionVersion (and optional alias). This is the same explicit-registration pattern blueprints and templates use โ pinning a version locks the dependency so the function keeps producing the same result even after the dependency publishes a new semver.
- bodyType: stringrequired
The JSONata expression that computes the return value from the parameters. Standard JSONata syntax โ referenced parameters are scoped variables (no
$prefix), built-in JSONata functions are invoked with the$prefix (e.g.$sum,$now,$fromMillis), and other custom functions are invoked as$<alias>(...)for each callee declared infunctions[](alias defaults tofunctionKeywhen not specified). - returnType: object
Type requiredType the function returns. For primitives (
string,number,boolean), the baretypeis enough. Forobject, pair withschemaKey+schemaVersionto pin the produced shape to a schema. Forarray, pair withitemTypeto declare the element type (and addschemaKey+schemaVersionwhenitemTypeisobject).- typeType: stringenumrequired
The return type.
values- string
- number
- boolean
- object
- array
- itemType: stringenum
Type Element type when
typeisarray.values- string
- number
- boolean
- object
- schemaType: string
Key Schema key pinning the returned shape (when
typeisobject, or whentypeisarrayanditemTypeisobject). - schemaType: string
Version Version of the pinned schema (
draftor a published semver).
- functionsType: array object[]
Other JSONata functions this function calls from
body. Each entry pins a specificfunctionKey+functionVersion, with an optionalaliasused at call sites (defaults tofunctionKeywhen not specified). Aliases let you decouple call-site names from resource keys so you can rename or swap the callee later by changing this entry without touchingbody. Same shape used byBlueprintSpec.functionsandTemplateSpec.functions.- functionType: string
Key requiredResource key of the JSONata function being referenced.
- functionType: string
Version requiredSpecific version of the function being pinned (semver like
1.0.0ordraftwhile iterating). - aliasType: string
Pattern: ^[a-z][a-zA-Z0-9]*$Optional name used in JSONata expressions to invoke this function as
$<alias>(...). Defaults tofunctionKeywhen not specified.
- paramsType: array object[] ยท JsonataFunctionParam[]
Ordered list of input parameters. Inside
body, each is referenced by name without the$prefix (e.g.params: [{name: "amount"}]is read asamountin the expression).- nameType: string
Pattern: ^[a-z][a-zA-Z0-9]*$requiredParameter name. Becomes a variable accessible inside the function body โ referenced by name (no
$prefix). Convention: camelCase (e.g.amount,taxRate,startDate). - typeType: stringenumrequired
Parameter type. For primitives (
string,number,boolean), the baretypeis enough. Forobject, pair withschemaKey+schemaVersionto pin the expected shape. Forarray, pair withitemTypeto declare the element type (and addschemaKey+schemaVersionwhenitemTypeisobject).values- string
- number
- boolean
- object
- array
- itemType: stringenum
Type Element type when
typeisarray. For arrays of objects, also setschemaKey+schemaVersionto pin the element shape.values- string
- number
- boolean
- object
- schemaType: string
Key Schema key pinning the expected shape. Required when
typeisobject(or whentypeisarrayanditemTypeisobject). - schemaType: string
Version Version of the pinned schema (
draftor a published semver).
