Skip to main content
Comparison validators check values against expected content using various matching strategies.
All string comparison validators support transforms and negation.

Equality

eq!

Checks for exact equality between the actual and expected values.

ne!

Checks that the actual value does NOT equal the expected value. This is the negated form of eq!.

String Matching

contains!

Checks if the actual value contains the expected substring or item.

not_contains!

Checks that the actual value does NOT contain the expected substring or item.

contains_all!

Checks if the actual value contains ALL of the expected substrings or items.

not_contains_all!

Checks that the actual value does NOT contain all of the specified items (at least one must be missing). This is the negated form of contains_all!.

contains_any!

Checks if the actual value contains AT LEAST ONE of the expected substrings or items.

not_contains_any!

Checks that the actual value contains NONE of the specified items. This is the negated form of contains_any!.

pattern!

Checks if the actual value matches a regular expression pattern.
Regular expressions use Python’s re module syntax. Remember to escape special characters in YAML (use \\d instead of \d).

not_pattern!

Checks that the actual value does NOT match the regular expression pattern. This is the negated form of pattern!.

starts_with!

Checks if the actual value starts with the expected prefix.

not_starts_with!

Checks that the actual value does NOT start with the expected prefix. This is the negated form of starts_with!.

ends_with!

Checks if the actual value ends with the expected suffix.

not_ends_with!

Checks that the actual value does NOT end with the expected suffix. This is the negated form of ends_with!.

Numeric Comparisons

Numeric validators support integers, floats, and date strings.

lt!

Checks if the actual value is less than the expected value.

lte!

Checks if the actual value is less than or equal to the expected value.

gt!

Checks if the actual value is greater than the expected value.

gte!

Checks if the actual value is greater than or equal to the expected value.

Combining Comparison Validators

Combine validators for comprehensive checks:

Range Checks

Span Input/Output Validation