Search across all documentation pages
11 pages in this section.
Why Pydantic exists as a boundary-parsing layer rather than a general validation library, how pydantic-core's compiled schemas make that parsing fast, and why model_dump, model_dump_json, and model_json_schema answer three different questions - the mental model behind every other page in this section.
Learn Pydantic 2 basics with 9 examples covering model definition, validation errors, defaults, optional fields, and serializing data with model_dump.
Define Pydantic model fields with type constraints, default values, and aliases. Learn to validate API boundaries and handle common data validation gotchas.
Learn to use Pydantic field and model validators to normalize data, perform cross-field checks, and create computed derived fields.
Learn how to serialize Pydantic models using model_dump, field_serializer, and model_dump_json for API responses, events, and caching.
Load configuration from environment variables using pydantic-settings. Learn to manage typed environment variables, separate secrets, and avoid common pitfalls.
Compare Python dataclasses, Pydantic, and attrs for data modeling. Learn when to use each for DTOs, API validation, and immutable objects.
Learn Pydantic validation best practices for Python, covering boundary validation, model design, performance, and security considerations.
A single-page roundup of every highlight bullet from the 10 pages in the Pydantic section, grouped by source page so you can scan all 57 takeaways without opening each article individually.