datamodel-code-generator
datamodel-code-generator is useful when a team already has a data specification and needs corresponding Python models. An agent tool returning support tickets, for example, may need stable fields, enumerations and nested objects. Generating the models reduces repetitive declarations and makes the schema a visible starting point for changes.
The most important result of our review is that successful generation does not give every output type the same runtime behavior. The generated Pydantic model rejected several invalid inputs. A plain dataclass constructor accepted corresponding invalid values. Default coercion and nullable fields also needed explicit checks against the intended interface contract.
On November 4, 2026, we used datamodel-code-generator 0.88.0, Pydantic 2.14.2 and Python 3.12.13. Our handwritten draft-07 JSON Schema describes a support ticket with a required identifier, priority enumeration, nested requester, non-negative retry count, a limit on labels, and forbidden extra properties.
Read the full review, verification scope and sources →Features
Why choose it
Trade-offs
Maintenance check
- Last commit
- 2026-11-10
- Commits, last 90 days
- 100+
- Releases, last 90 days
- 23
- Latest release
- 0.92.0 (2026-11-10)
- Open issues
- 93
- Recent issues with at least one comment
- 1/18
Oldest week on the left; the latest four weeks are orange. Source: GitHub commit activity.
Status rule: archived on GitHub = Archived; last commit within 90 days = Active; 91 to 365 days = Slowing; older = Stale. All figures come from the GitHub API on the date shown.
Most discussed open issues
- #2022 Add Swift codable structs support7 comments · 2024-06-30
- #2775 Migrate to Ruff as the default formatter for improved performance3 comments · 2025-12-24
- #419 SQL DDL as source input3 comments · 2021-04-28
- #3658 Support ATProto lexicons as input2 comments · 2026-07-26
- #3058 Option to not install formatters2 comments · 2026-03-18
Issue titles are quoted from GitHub. Open the link to check whether a problem still applies to the version you use.
Who it fits
- You already maintain a schema and want repeatable generation of Python data models.
- You can test validation, coercion, omission and null behavior against your interface contract.
- The domain contract is still undefined and you expect code generation to decide it.
- You need every generated output type to perform identical runtime validation automatically.
Compatibility
Quick start
Use cases
Alternatives
Comments
No comments yet. Be the first!