Skip to content

Build: Bump datamodel-code-generator from 0.53.0 to 0.54.0#15319

Open
dependabot[bot] wants to merge 1 commit intomainfrom
dependabot/pip/datamodel-code-generator-0.54.0
Open

Build: Bump datamodel-code-generator from 0.53.0 to 0.54.0#15319
dependabot[bot] wants to merge 1 commit intomainfrom
dependabot/pip/datamodel-code-generator-0.54.0

Conversation

@dependabot
Copy link
Contributor

@dependabot dependabot bot commented on behalf of github Feb 15, 2026

Bumps datamodel-code-generator from 0.53.0 to 0.54.0.

Release notes

Sourced from datamodel-code-generator's releases.

0.54.0

Breaking Changes

Code Generation Changes

  • Enum member names from oneOf/anyOf const constructs now use title field when provided - Previously, when creating enums from oneOf/anyOf constructs with const values, the title field was incorrectly ignored and enum member names were generated using the pattern {type}_{value} (e.g., integer_200). Now, when a title is specified, it is correctly used as the enum member name (e.g., OK instead of integer_200). Users who have code depending on the previously generated enum member names will need to update their references. (#2975) Before:
    class StatusCode(IntEnum):
        integer_200 = 200
        integer_404 = 404
        integer_500 = 500
    After:
    class StatusCode(IntEnum):
        OK = 200
        Not_Found = 404
        Server_Error = 500
  • Field names matching Python builtins are now automatically sanitized - When a field name matches a Python builtin type AND the field's type annotation uses that same builtin (e.g., int: int, list: list[str], dict: dict[str, Any]), the field is now renamed with a trailing underscore (e.g., int_) and an alias is added to preserve the original JSON field name. This prevents Python syntax issues and shadowing of builtin types. Previously, such fields were generated as-is (e.g., int: int | None = None), which could cause code that shadows Python builtins. After this change, the same field becomes int_: int | None = Field(None, alias='int'). This affects fields named: int, float, bool, str, bytes, list, dict, set, frozenset, tuple, and other Python builtins when their type annotation uses the matching builtin type. (#2968)
  • $ref with non-standard metadata fields no longer triggers schema merging - Previously, when a $ref was combined with non-standard fields like markdownDescription, if, then, else, or other extras not in the whitelist, the generator would merge schemas and potentially create duplicate models (e.g., UserWithExtra alongside User). Now, only whitelisted schema-affecting extras (currently just const) trigger merging. This means:
    • Fewer merged/duplicate models will be generated
    • References are preserved directly instead of being expanded
    • Field types may change from inline merged types to direct references Example schema:
    properties:
      user:
        $ref: "#/definitions/User"
        nullable: true
        markdownDescription: "A user object"
    Before: Could generate a merged UserWithMarkdownDescription model After: Directly uses User | None reference (#2993)
  • Enum member names no longer get underscore suffix with --capitalise-enum-members - Previously, enum values like replace, count, index would generate REPLACE_, COUNT_, INDEX_ when using --capitalise-enum-members. Now they correctly generate REPLACE, COUNT, INDEX. The underscore suffix is only added when --use-subclass-enum is also used AND the lowercase name conflicts with builtin type methods. Users relying on the previous naming (e.g., referencing MyEnum.REPLACE_ in code) will need to update to use the new names without trailing underscores. (#2999)
  • Fields using $ref with inline keywords now include merged metadata - When a schema property uses $ref alongside additional keywords (e.g., const, enum, readOnly, constraints), the generator now correctly merges metadata (description, title, constraints, defaults, readonly/writeOnly) from the referenced schema into the field definition. Previously, this metadata was lost. For example, a field like type: Type may now become type: Type = Field(..., description='Type of this object.', title='type') when the referenced schema includes those attributes. This also affects additionalProperties and OpenAPI parameter schemas. (#2997)

What's Changed

... (truncated)

Changelog

Sourced from datamodel-code-generator's changelog.

0.54.0 - 2026-02-14

Breaking Changes

Code Generation Changes

  • Enum member names from oneOf/anyOf const constructs now use title field when provided - Previously, when creating enums from oneOf/anyOf constructs with const values, the title field was incorrectly ignored and enum member names were generated using the pattern {type}_{value} (e.g., integer_200). Now, when a title is specified, it is correctly used as the enum member name (e.g., OK instead of integer_200). Users who have code depending on the previously generated enum member names will need to update their references. (#2975) Before:
    class StatusCode(IntEnum):
        integer_200 = 200
        integer_404 = 404
        integer_500 = 500
    After:
    class StatusCode(IntEnum):
        OK = 200
        Not_Found = 404
        Server_Error = 500
  • Field names matching Python builtins are now automatically sanitized - When a field name matches a Python builtin type AND the field's type annotation uses that same builtin (e.g., int: int, list: list[str], dict: dict[str, Any]), the field is now renamed with a trailing underscore (e.g., int_) and an alias is added to preserve the original JSON field name. This prevents Python syntax issues and shadowing of builtin types. Previously, such fields were generated as-is (e.g., int: int | None = None), which could cause code that shadows Python builtins. After this change, the same field becomes int_: int | None = Field(None, alias='int'). This affects fields named: int, float, bool, str, bytes, list, dict, set, frozenset, tuple, and other Python builtins when their type annotation uses the matching builtin type. (#2968)
  • $ref with non-standard metadata fields no longer triggers schema merging - Previously, when a $ref was combined with non-standard fields like markdownDescription, if, then, else, or other extras not in the whitelist, the generator would merge schemas and potentially create duplicate models (e.g., UserWithExtra alongside User). Now, only whitelisted schema-affecting extras (currently just const) trigger merging. This means:
    • Fewer merged/duplicate models will be generated
    • References are preserved directly instead of being expanded
    • Field types may change from inline merged types to direct references Example schema:
    properties:
      user:
        $ref: "#/definitions/User"
        nullable: true
        markdownDescription: "A user object"
    Before: Could generate a merged UserWithMarkdownDescription model After: Directly uses User | None reference (#2993)
  • Enum member names no longer get underscore suffix with --capitalise-enum-members - Previously, enum values like replace, count, index would generate REPLACE_, COUNT_, INDEX_ when using --capitalise-enum-members. Now they correctly generate REPLACE, COUNT, INDEX. The underscore suffix is only added when --use-subclass-enum is also used AND the lowercase name conflicts with builtin type methods. Users relying on the previous naming (e.g., referencing MyEnum.REPLACE_ in code) will need to update to use the new names without trailing underscores. (#2999)
  • Fields using $ref with inline keywords now include merged metadata - When a schema property uses $ref alongside additional keywords (e.g., const, enum, readOnly, constraints), the generator now correctly merges metadata (description, title, constraints, defaults, readonly/writeOnly) from the referenced schema into the field definition. Previously, this metadata was lost. For example, a field like type: Type may now become type: Type = Field(..., description='Type of this object.', title='type') when the referenced schema includes those attributes. This also affects additionalProperties and OpenAPI parameter schemas. (#2997)

What's Changed

... (truncated)

Commits
  • 2ea6244 Fix incorrect relative imports with --use-exact-imports and --collapse-root-m...
  • 34b7d29 fix codespeed python version (#3000)
  • f3ef9c6 Fix merged result in parse_item not passed back to parse_object_fields (#2997)
  • 5011903 Fix extra underscore on enum members like replace with --capitalise-enum-memb...
  • 907a1a8 Fix exact imports with module/class name collision (#2998)
  • 2b659f0 Fix missing | None for nullable enum literals in TypedDict (#2991)
  • 992af20 Fix type loss when $ref is used with non-standard metadata fields (#2993)
  • 0f1bc0f Fix patternProperties/propertyNames key constraints lost with field_constrain...
  • 24b576e Fix missing Field import with multiple aliases on required fields (#2992)
  • b58970a Fix RecursionError in _merge_ref_with_schema for circular $ref (#2983)
  • Additional commits viewable in compare view

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

Bumps [datamodel-code-generator](https://github.com/koxudaxi/datamodel-code-generator) from 0.53.0 to 0.54.0.
- [Release notes](https://github.com/koxudaxi/datamodel-code-generator/releases)
- [Changelog](https://github.com/koxudaxi/datamodel-code-generator/blob/main/CHANGELOG.md)
- [Commits](koxudaxi/datamodel-code-generator@0.53.0...0.54.0)

---
updated-dependencies:
- dependency-name: datamodel-code-generator
  dependency-version: 0.54.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
@dependabot dependabot bot added dependencies Pull requests that update a dependency file python labels Feb 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file OPENAPI python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants