Skip to main content

Category

Pydantic v2 in production: boundary validation, performance, custom types and LLM output

Pydantic expresses one discipline declaratively, through type annotations: do not trust data arriving from outside the system. Built on the Rust pydantic-core, it validates external input, configuration, API payloads and LLM output as models, and lets only trustworthy data through. This cluster runs from the fundamentals of boundary validation to performance work with TypeAdapter and discriminated unions, reusable Annotated types, and the places where a validation library decides whether a service degrades gracefully or corrupts data quietly.

10 articles in total

Foundational guide

Foundational guide (start here)

Python
Pydantic
型安全
バリデーション
FastAPI

Pydantic v2 Practical Guide: Protect the System Boundary with Types and Pass Only Trustworthy Data

Faithful to the Pydantic v2 official documentation, we explain — from a boundary-validation practical perspective — declarative models with BaseModel/Field, field_validator/model_validator, model_dump, ConfigDict and strict mode, pydantic-settings, and v1 migration.

16 min read

Related practical articles