Skip to main content

The check step

A check step describes one business rule. Its violationWhen formula must produce a boolean: true produces a violation, and false produces null. The violation is an object with code, severity and message. Raising a violation lets the run finish; it does not itself fail the run.

FieldMeaning
idA step identifier, using lowercase letters, digits and hyphens.
typeAlways check.
violationWhenA boolean formula describing when the rule is violated.
rule.codeA 2–64 character code, starting with an uppercase letter, followed by uppercase letters or digits and optional hyphen-separated groups. Examples: BR-01, TOTAL-POSITIVE.
rule.severityerror or warning. Change error to warning to relax a rule, or remove the step to remove the rule.
rule.messageA plain-text message with optional de and en members. At least one language must contain non-whitespace text; no other keys are accepted.
onErrorOptional handling of an execution error, as on other steps. This handles failures while evaluating the condition; it does not change the effect of raising a business-rule violation.

A check has no child steps. Use distinct codes so a violation identifies the rule that raised it; repeated codes produce a warning.

Messages and languages​

Write both German and English messages for a template. Template publication requires both languages; a tenant's own message may use just one. Empty or whitespace-only members count as missing.

The run resolves the message into a single string in its language. On job submission, locale selects de or en; when omitted, the tenant's configured default language is used. That choice is captured for the run and used by its check steps. See Submit a job.

If a message lacks the run's language, it uses the other language. For an engine evaluation with no locale, English is preferred, then German. Messages remain plain text, including when they contain characters that resemble markup.

Collecting violations​

Use ARGS to collect check values, FLATTEN to splice one level of arrays (such as a foreach's check results), and COMPACT to remove nulls. The result contains only the violations that were raised. FLATTEN preserves deeper arrays; COMPACT keeps false, zero and empty strings.

This complete example checks a single submitted invoice inside one foreach container, preserving the ruleset's single top-level-step structure. Its output is a one-element array containing an object with a violations array. Both checks are independent; either, both, or neither may raise a violation.

{
"schemaVersion": 1,
"name": "invoice-business-checks",
"inputSchema": {
"type": "object",
"properties": {
"invoice": {
"type": "object",
"properties": {
"amount": { "type": "number" },
"vatId": { "type": "string" }
},
"required": ["amount", "vatId"]
}
},
"required": ["invoice"]
},
"output": "validate",
"outputSchema": {
"type": "array",
"items": {
"type": "object",
"properties": {
"violations": {
"type": "array",
"items": {
"type": "object",
"properties": {
"code": { "type": "string" },
"severity": { "type": "string" },
"message": { "type": "string" }
},
"required": ["code", "severity", "message"]
}
}
},
"required": ["violations"]
}
},
"steps": [
{
"id": "validate",
"type": "foreach",
"collection": "ARGS(input.invoice)",
"itemVar": "invoice",
"output": "result",
"steps": [
{
"id": "total-positive",
"type": "check",
"violationWhen": "invoice.amount <= 0",
"rule": {
"code": "TOTAL-POSITIVE",
"severity": "error",
"message": {
"de": "Der Gesamtbetrag muss größer als null sein.",
"en": "The total amount must be greater than zero."
}
}
},
{
"id": "vat-present",
"type": "check",
"violationWhen": "invoice.vatId == ''",
"rule": {
"code": "VAT-PRESENT",
"severity": "warning",
"message": {
"de": "Eine Umsatzsteuer-ID fehlt.",
"en": "A VAT identifier is missing."
}
}
},
{
"id": "result",
"type": "compute",
"outputs": {
"violations": "COMPACT(FLATTEN(ARGS(steps[\"validate/total-positive\"], steps[\"validate/vat-present\"])))"
}
}
]
}
]
}

For line-level rules, name the check as the foreach's output; that foreach then returns an array of nulls and violation objects. Include that array in the final ARGS call alongside other check values, and the same COMPACT(FLATTEN(ARGS(...))) pattern collects them in order.