Assert
Assert (assert)
Section titled “Assert (assert)”Validate an event against a JSON Schema, based on IETF’s draft v7 (http://json-schema.org).
Validation json
Minimal example
Section titled “Minimal example”actions: - assert: behaviour: no-warnings: drop-onfailure schema: schema-file: ""JSON
{ "actions": [ { "assert": { "behaviour": { "no-warnings": "drop-onfailure" }, "schema": { "schema-file": "" } } } ]}Contents
Section titled “Contents”A ✓ marks a field that accepts a context variable such as
{{ VARIABLE }}.
Fields
Section titled “Fields”| Field | Type | Required | Description |
|---|---|---|---|
description |
string |
describe this step. | |
condition |
lua-expression (string) |
Only run this action if the specified condition is met. Examples: 2 * count() |
|
schema |
Schema |
✅ | The JSON schema to validate an event against. Allowed values: schema-file, schema-string, checks |
behaviour |
Behaviour |
✅ | What the job should do if it encounters a schema violation. Allowed values: no-warnings, drop-onfailure, abort-on-failure |
suppress-warnings ✓ |
boolean (bool) |
Suppress warnings generated by this action. Default: false |
Schema
Section titled “Schema”- Schema Options
- Behaviour Options
- Schema - Checks - Checks Fields
- Schema - Checks - Output Fields
- Schema - Checks Fields
- Schema - Checks - Checks - Kind Options
- Behaviour - No Warnings Options
Schema Options
Section titled “Schema Options”| Option | Name | Type | Description |
|---|---|---|---|
schema-file |
Schema File | string |
File containing JSON schema. Examples: /path/to/file, c:\users\joe\data\file.txt |
schema-string |
Schema String | string |
JSON schema as text. |
checks |
Checks | object |
Structured assertion checks (number/date/time/in-set). |
Behaviour Options
Section titled “Behaviour Options”| Option | Name | Type | Description |
|---|---|---|---|
no-warnings |
No Warnings | symbol |
Switch off warnings. Allowed values: drop-onfailure, abort-on-failure |
drop-onfailure |
Drop Onfailure | bool |
Just Drop the Event. Default: false |
abort-on-failure |
Abort On Failure | bool |
Abort the job. Default: false |
Schema - Checks - Checks Fields
Section titled “Schema - Checks - Checks Fields”| Field | Type | Required | Description |
|---|---|---|---|
name |
string |
Optional check identifier used in annotations. | |
kind |
Kind |
✅ | Check kind. Allowed values: number, date, time, in-set |
field |
string |
✅ | Source field for this check. |
required ✓ |
boolean (bool) |
Whether the field is required. Default: false |
|
code |
string |
Optional custom failure code. | |
allow-decimal ✓ |
boolean (bool) |
Number check option: allow decimal values. Default: true |
|
allow-negative ✓ |
boolean (bool) |
Number check option: allow negative values. Default: false |
|
format |
string |
Date/time format hint (currently YYYY/MM/DD or HH:MM). |
|
values |
string[] |
In-set check option: allowed values. | |
case-insensitive ✓ |
boolean (bool) |
In-set check option: case-insensitive matching. Default: false |
Schema - Checks - Output Fields
Section titled “Schema - Checks - Output Fields”| Field | Type | Required | Description |
|---|---|---|---|
annotation-field |
field (string) |
Field receiving per-check annotations (defaults to _assert).Examples: data_field |
|
ok-field |
field (string) |
Field receiving overall success (true when all checks pass).Examples: data_field |
|
issues-field |
field (string) |
Field receiving ordered failure codes. Examples: data_field |
Schema - Checks Fields
Section titled “Schema - Checks Fields”| Field | Type | Required | Description |
|---|---|---|---|
checks |
Checks[] |
Ordered list of checks to evaluate. | |
output |
Output |
Optional output field configuration for check annotations. |
Schema - Checks - Checks - Kind Options
Section titled “Schema - Checks - Checks - Kind Options”| Value | Aliases | Name | Description |
|---|---|---|---|
number |
number | ||
date |
date | ||
time |
time | ||
in-set |
in-set |
Behaviour - No Warnings Options
Section titled “Behaviour - No Warnings Options”| Value | Aliases | Name | Description |
|---|---|---|---|
drop-onfailure |
drop-onfailure | ||
abort-on-failure |
abort-on-failure |