finds.dev← search

// the find

koxudaxi/datamodel-code-generator

★ 3,944 · Python · MIT · updated Jun 2026

Generate Pydantic v2 models, dataclasses, TypedDict, and msgspec.Struct from OpenAPI, JSON Schema, GraphQL, Avro, Protobuf, and raw JSON/YAML/CSV.

datamodel-code-generator takes schema definitions — OpenAPI, JSON Schema, Protobuf, Avro, GraphQL, and more — and spits out typed Python models in your choice of Pydantic v2, dataclasses, TypedDict, or msgspec. It's been around long enough to have serious real-world adoption: Apache Airflow, PostHog, Apache Iceberg, and OpenTelemetry all use it in their build pipelines.

The input format coverage is genuinely broad and not just superficial — it handles $ref resolution, allOf/oneOf/anyOf composition, nested types, and enums correctly across formats, which is where most similar tools fall apart. The preset system (e.g. standard-py312-20260619) is a smart solution to the CLI options sprawl problem; you get reproducible, datestamped output without memorizing 20 flags. The in-browser playground running via Pyodide is actually useful for debugging why a schema produces unexpected output, and the conformance dashboard running against real external corpora (W3C XSD suite, JSON Schema Test Suite) gives you honest signal on what it can and can't handle. The --input-model flag to retarget existing Python types from one style to another is a feature most people don't know they need until they're migrating from dataclasses to Pydantic.

Generated code quality degrades on messy real-world OpenAPI specs — deeply nested oneOf/anyOf combinations often produce verbose, unwieldy union types that need manual cleanup before they're actually usable. The default formatter is still Black + isort, which means a cold run pulls in formatter dependencies even if you don't use them in your project; the builtin formatter is opt-in and not the default yet, which is backwards. Protobuf support lags the other input formats — gRPC service definitions are ignored entirely, so you get model types but nothing to do with RPC methods. The maintainer is actively job-hunting (noted prominently in the README), which is an honest signal about single-maintainer bus factor risk for a project this widely depended on.

View on GitHub → Homepage ↗

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →