Expand description
The Validate trait and its implementations for standard types.
Validation has two phases, mirroring Pydantic’s before/after split:
Validate::prepareruns on the rawValuebefore deserialization. It is type driven: every type checks and, in lax mode, coerces its own slot of the input ("42"→42for integers, trimming for strings, …). Derived models walk their fields, report missing/extra keys and recurse with the location extended. Because all errors are collected here, one request reports every problem at once.Validate::validateruns on the typed value after deserialization: field constraints, after-validators, model validators.
Both phases push errors into a ValidationContext; neither panics.
Traits§
- Validate
- A type that takes part in validation.