Let JSON Schema and Pydantic write your data models
summary
Uses Pydantic plus JSON Schema to autogenerate client-side models and validation, converting schemas into runtime Pydantic models with a custom generator. Drops ~15% of instance-checking code and scales to 10,000 models in the codebase. Development for a group of models shrinks from hours of manual DTO editing to minutes of generation, moves validation to the client to avoid repeat bad requests, and the generator proves flexible enough for project-specific additions.
AI-written summary · about
chapters (8)
- 0:00Introduction
- 3:04Problems with API clients
- 5:56Data models maintenance challenges
- 7:40Pydantic for validation
- 10:15JSON Schema basics
- 13:37JSON Schema advantages
- 17:38Pydantic and JSON Schema
- 19:30Generating models from schema
related talks
26mIntro to Pydantic, run-time type checking for your dataclasses
27mFrom Pydantic V1 to V2
22mPydantic Power-up: Performance Tips for Lightning-Fast Python Applications
30mREST & GraphQL: Adventures in schema-first API development
04mLightning Talk JSON Schema
28m"Validating Complex Types Using Pydantic"
39mJSONSchema as a runtime type system - Advanced concepts and practical uses
46mHow Pydantic V2 leverages Rust's Superpowers
