pypi / datamodel-code-generator
datamodel-code-generator
What changed in datamodel-code-generator 0.60 to 0.86, from its official release notes, upgrade guides and advisories. Sources checked 2026-10-21.
10 breaking13 security1 deprecations4 new APIs and options4 behavior and defaults7 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initdatamodel-code-generator 0.8616 changes
Breaking changes 5
Mapped format: byte strings with length constraints now generate Annotated bytes using EncodedBytes and Base64Encoder, decoding base64 and checking lengths on the encoded text.
Mapped format: byte fields under strict bytes now decode base64 instead of holding raw text; FastAPI path, query, header, and cookie parameters no longer stop generation with an error.
Mapped format: byte values without constraints now pass through base64 decoding, including byte strings in multi-type schemas.
Integer and subclass enums listing null no longer generate a None member that raises TypeError on import; an enum containing only null becomes RootModel[None].
Optional one-value Literal discriminator tags now default to their sole value instead of None, allowing the discriminated union to import.
Deprecations 1
The generator warns about msgspec unions containing an Enum alongside another member of the same JSON type.
New APIs and options 3
Adds schema analysis and rule-based recommendations for generation options.
Adds an option to represent single-value enums as constants; nullable unions and mixed-type branches are kept distinct, and nullable single-value enums remain enums that accept null.
Adds an option to use tag values as union variant names; prefixed names of models inside key-named branches no longer repeat the key.
Behavior and default changes 2
Long Annotated assignments with a None default are wrapped like black; --check with a dated preset using the builtin formatter reports the reformatting.
Warns when keys in the model name map match no generated model.
Fixes and other changes 5
Number constraints are no longer emitted on generated fields whose types do not take them.
Pydantic discriminator tag fields no longer carry a pattern that every tag value already satisfies, avoiding generated output that fails at import.
Generated msgspec Structs are flattened when their generated bases have conflicting layouts.
A stale name for a renamed type is released from a package __init__ re-import.
Generated code now imports the object that holds enum members used by x-python-type Literals.
datamodel-code-generator 0.8510 changes
Breaking changes 5
Output encoding failures now raise datamodel_code_generator.Error instead of codec exceptions; modular output writes no files if a module cannot be encoded.
Unknown encodings and codecs that are not text encodings are rejected during config preparation, before input is read or output paths are created.
The builtin formatter now classifies standard-library imports using the target Python version; when no target is given, it uses 3.10.
Non-ASCII generated names now follow the target Python version's Unicode rules, which can change field, class, enum member, and module names.
Generation fails if a referenced standard-library type is unavailable in the target Python version.
New APIs and options 1
Python 3.15 is now available as a target version.
Behavior and default changes 2
The builtin formatter now places each module in a multi-module import statement in its own section according to its category.
Explicit names are validated against the target Python version's identifier rules rather than those of the running interpreter.
Fixes and other changes 2
Model reuse now recognizes references starting with non-ASCII letters, so equivalent models can be reused instead of emitted as duplicates.
Newer typing and collections.abc names requested through overrides or schema import paths are imported from typing_extensions when unavailable in the target Python version.
datamodel-code-generator 0.811 changes
Security 1
datamodel-code-generator: Protobuf weak-import path traversal allows files to be written outside the temporary directory
datamodel-code-generator 0.641 changes
Security 1
datamodel-code-generator vulnerable to code injection via
x-python-import/customTypePathin generated import statements
datamodel-code-generator 0.632 changes
Security 2
datamodel-code-generator: Authorization / request headers leaked to cross-origin redirect target when fetching remote schemas
datamodel-code-generator vulnerable to SSRF protection bypass via DNS rebinding
datamodel-code-generator 0.622 changes
Security 2
datamodel-code-generator vulnerable to arbitrary local file read via JSON-Schema
$ref(file://and../traversal), bypassing--no-allow-remote-refsdatamodel-code-generator vulnerable to arbitrary local file read via XSD
schemaLocation(xs:include/xs:import) path traversal, with no remote-ref gate
datamodel-code-generator 0.612 changes
Security 2
datamodel-code-generator vulnerable to SSRF via JSON-Schema
$refto HTTP URL (silent by default)datamodel-code-generator vulnerable to SSRF via --url: no host/IP validation, follows redirects
datamodel-code-generator 0.605 changes
Security 5
datamodel-code-generatorvulnerable to code execution on import via unescapedvalidatorsentries in --extra-template-datadatamodel-code-generatorvulnerable to code execution on import viax-python-typeJSON-Schema extension in datamodel-code-generatordatamodel-code-generatorvulnerable to code injection in via attacker-controlleddefault_factoryschema fielddatamodel-code-generatorvulnerable to code injection via unescaped carriage return in--extra-template-datacommentfielddatamodel-code-generatorvulnerable to code injection via unescaped carriage return in GraphQL Union description