Custom Functions
A Custom Function is a reusable, versioned snippet of JSONata logic — a composable primitive for business logic. Define it once and call it from any expression in your templates or blueprints — valueExpression, displayCondition, data.transform, or onComplete mappers.
Functions let you encapsulate complex business logic (currency formatting, tax calculations, date math) in a single place. When the logic changes, update the function — not every expression that uses it. Like all SignStack primitives, functions are versioned and authored wherever you prefer — Studio, the CLI as YAML in your repo, or the API.
YAML Format
apiVersion: signstack/v1beta2
kind: JsonataFunction
metadata:
key: format_currency # Required, snake_case
version: 1.0.0 # Required, semver
name: Format Currency # Required
description: Formats a number as USD currency string
labels:
category: formatting
spec:
params: # Optional: function parameters
- name: amount # Valid JS identifier
type: number # string, number, boolean, or object
# schema: address_schema@1.0.0 # Required when type is object
returnType: # Required
type: string
# schema: address_schema@1.0.0 # Required when type is object
body: "'