Validators are ordinary callables that take a single argument (the input value) and return a transformed result value. They can also raise validation errors.
IValidator(value)
Validates the input value
and possibly transforms it.
Returns the new value. If the value is invalid, raises a decent.error.Error
or decent.error.Invalid
exception.
Validator callables can be used inside schemas, but also standalone.
Decent ships with many built-in validators that can be used and combined for usual tasks. Instances of them are built through the following constructors:
decent.validators.All
decent.validators.Any
decent.validators.Default
decent.validators.Maybe
decent.validators.Msg
decent.validators.Eq
decent.validators.Coerce
decent.validators.Instance
decent.validators.Type
decent.validators.List
decent.validators.Length
decent.validators.Boolean
decent.validators.Range
decent.validators.Length
decent.validators.Lower
decent.validators.Upper
decent.validators.Strip
decent.validators.Length
decent.validators.Uuid