All string comparison validators support transforms and negation.
Equality
eq!
Checks for exact equality between the actual and expected values.Examples
Examples
ne!
Checks that the actual value does NOT equal the expected value. This is the negated form ofeq!.
Examples
Examples
String Matching
contains!
Checks if the actual value contains the expected substring or item.Examples
Examples
not_contains!
Checks that the actual value does NOT contain the expected substring or item.Examples
Examples
contains_all!
Checks if the actual value contains ALL of the expected substrings or items.Examples
Examples
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 ofcontains_all!.
Examples
Examples
contains_any!
Checks if the actual value contains AT LEAST ONE of the expected substrings or items.Examples
Examples
not_contains_any!
Checks that the actual value contains NONE of the specified items. This is the negated form ofcontains_any!.
Examples
Examples
pattern!
Checks if the actual value matches a regular expression pattern.Examples
Examples
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 ofpattern!.
Examples
Examples
starts_with!
Checks if the actual value starts with the expected prefix.Examples
Examples
not_starts_with!
Checks that the actual value does NOT start with the expected prefix. This is the negated form ofstarts_with!.
Examples
Examples
ends_with!
Checks if the actual value ends with the expected suffix.Examples
Examples
not_ends_with!
Checks that the actual value does NOT end with the expected suffix. This is the negated form ofends_with!.
Examples
Examples
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.Numeric comparison examples
Numeric comparison examples