AntiPattern
Type-Driven Serialization Mismatch
type-driven-serialization-mismatch
Pydantic/FastAPI serialization and request validation follow declared field types (and shared ORM models), so excluding or transforming fields at the API boundary doesn’t reliably work; payloads either drop needed data or emit nested objects instead of intended primitives.