DefineParse & validateSerialize
Choose your version
These examples target Rydantic 0.7.0 stable. Review the release notes for the breaking explicit-derive contract when upgrading from 0.6.0. For older deployments, use the 0.6.0 tagged guide.
Add the dependency
Cargo.toml
Define your first model
src/main.rs
Model also generates Serde’s Serialize and Deserialize implementations. Derive Model once per model. Deserialization runs full validation, and serialization revalidates the current object.
Run an example
From the source checkout, run the model or tool-call examples:Next steps
Validation rules
Explore constraints, defaults and normalization.
Follow the tutorials
Build a model, CRUD API and typed AI agent step by step.
Run an example
Find feature flags, complete programs and expected output.
Optional integrations
Enable HTTP, SQL, Cap’n Proto and other features.