Mark nodes for special treatment.
Mark a node in the schema as optional.
Report a user-friendly message if a schema fails to validate. Messages are only applied to invalid direct descendants of the schema.
Coerce a value to a type.
If the type constructor throws a ValueError, the value will be marked as Invalid.
Assert that a value is true, in the Python sense. “In the Python sense” means that implicitly false values, such as empty lists, dictionaries, etc. are treated as “false”:
Convert human-readable boolean values to a bool.
Accepted values are 1, true, yes, on, enable, and their negatives. Non-string values are cast to bool.
Use the first validated value.
Parameters: | msg – Message to deliver to user if validation fails. |
---|---|
Returns: | Return value of the first validator that passes. |
Value must pass all validators.
The output of each validator is passed as input to the next.
Parameters: | msg – Message to deliver to user if validation fails. |
---|
Value must match the regular expression.
Pattern may also be a compiled regular expression:
Verify the path exists, regardless of its type.
Limit a value to a range.
Either min or max may be omitted.
Raises Invalid: | If the value is outside the range and clamp=False. |
---|
Clamp a value to a range.
Either min or max may be omitted.