Skip to content

String Predicate

Provi edited this page Jul 22, 2026 · 2 revisions

String Predicates are used to test the value of a string or a list of strings.

Fields

Field Type Default Description
whitelist List of Strings [] The list of allowed strings.
blacklist List of String [] The list of banned strings.
whitelist_is_subset Boolean false Used only for testing collections, if true the whitelist is treated as a list of "required" strings instead and the collection will be allowed to have strings outside the whitelist.

Procedure

Testing a Single String

If the whitelist has values, then the string must be non-null and in the list, otherwise the predicate returns false.
If the whitelist is empty, then the string may be null but it must not be in the blacklist, otherwise the predicate returns false.

Testing a Collection of Strings

If any value in the list is also in the blacklist, the predicate returns false.

If whitelist_is_subset is true, then all values in the whitelist must also be in the list. Values outside of the whitelist are still permitted.
If whitelist_is_subset is false, then every element in the list is tested individually as if it were a single value. The predicate returns true if and only if every element also passes the predicate.

Examples

This tests if the input is either "example" or "test". Any other input values will fail.

{
  "whitelist": ["example", "test"]
}

Clone this wiki locally