Contains
Synopsis
Checks if a specified field value exists within a list of values, enabling conditional processing based on value matching. This is useful for filtering, routing, or validating data based on predefined or dynamic lists.
Schema
contains:
- field: <ident>
- description: <text>
- if: <script>
- ignore_failure: <boolean>
- ignore_missing: <boolean>
- list: <string[]>
- list_field: <ident>
- on_failure: <processor[]>
- on_success: <processor[]>
- tag: <string>
Configuration
Field | Required | Default | Description |
---|---|---|---|
field | Y | - | Field containing the value to check |
description | N | - | Explanatory note |
if | N | - | Condition to run |
ignore_failure | N | false | See Handling Failures |
ignore_missing | N | false | If true and field does not exist, exit quietly without making any modifications |
list | N | - | Static list of values to check against |
list_field | N | - | Field containing the dynamic list of values to check against |
on_failure | N | - | See Handling Failures |
on_success | N | - | See Handling Success |
tag | N | - | Identifier |
Details
The list can be provided directly or referenced from another field.
Either list
or list_field
must be specified, but not both, and the field being checked must contain a string value. The processor will fail if neither list
nor list_field
is provided, or if the specified field contains a non-string value.
Examples
Static List
Check if a value exists in a static list... |
|
returns success because "active" is in the list |
Dynamic List
Check against a list stored in another field... |
|
returns success because "admin" is in allowed_types |
Missing Fields
When the field is missing and ignore_missing is true... |
|
processor exits quietly without modification |
Templates
List values can use template syntax... |
|
templates are evaluated before checking |