Skip to content

Conversation

@dependabot
Copy link
Contributor

@dependabot dependabot bot commented on behalf of github Jan 1, 2026

Bumps datamodel-code-generator from 0.50.0 to 0.51.0.

Release notes

Sourced from datamodel-code-generator's releases.

0.51.0

Breaking Changes

Code Generation Changes

  • Different output when using --input-model with Set, FrozenSet, Mapping, or Sequence types - When using --input-model to convert Pydantic models or dataclasses, types that were previously converted to list or dict are now preserved as their original Python types. For example, a field typed as Set[str] now generates set[str] instead of list[str], FrozenSet[T] generates frozenset[T], Mapping[K, V] generates Mapping[K, V] instead of dict[K, V], and Sequence[T] generates Sequence[T] instead of list[T]. This may cause type checking differences or runtime behavior changes if your code depended on the previous output types. (#2837)
  • allOf multi-ref with property overrides now preserves inheritance - Schemas using allOf with multiple $ref items where the child schema also defines properties that override parent properties will now generate classes with multiple inheritance (e.g., class Person(Thing, Location)) instead of a flattened single class with all properties merged inline. Previously, child property overrides were incorrectly treated as conflicts, triggering schema merging. Users relying on the flattened output may need to adjust their code. (#2838) Before:
    class Person(BaseModel):
        type: str | None = 'playground:Person'
        name: constr(min_length=1) | None = None
        address: constr(min_length=5)
        age: int | None = None
    After:
    class Thing(BaseModel):
        type: str
        name: constr(min_length=1)
    class Location(BaseModel):
        address: constr(min_length=5)
    class Person(Thing, Location):
        type: str | None = 'playground:Person'
        name: constr(min_length=1) | None = None
        age: int | None = None
  • Ruff unsafe fixes now applied automatically - When using the ruff-check formatter, the --unsafe-fixes flag is now passed to ruff, which enables fixes that may change code behavior in potentially incorrect ways. This includes removing unused imports that might have side effects, removing unused variables that could affect debugging, and other transformations ruff considers "unsafe". Users who relied on the previous conservative safe-only fix behavior may see different generated code output. To restore the previous behavior, users can configure ruff via pyproject.toml or ruff.toml to disable specific unsafe rules. (#2847)
  • Type aliases now generate as class inheritance - When using --reuse-model (Pydantic v2 only), models that would previously generate as type aliases (ChildModel = ParentModel) now generate as explicit subclasses (class ChildModel(ParentModel): pass). This change improves type checker compatibility and maintains proper type identity, but may affect code that relied on type alias semantics or compared types directly. (#2853) Before:
    ArmLeft = ArmRight
    After:
    class ArmLeft(ArmRight):
        pass
  • Fields with const values in anyOf/oneOf now generate Literal types instead of inferred base types - Previously, a const value like "MODE_2D" in an anyOf/oneOf schema would generate str type. Now it generates Literal["MODE_2D"]. This change affects type hints in generated models and may require updates to code that type-checks against the generated output. For example:
    # Before (v0.x)
    map_view_mode: str = Field("MODE_2D", alias="mapViewMode", const=True)
    apiVersion: str = Field('v1', const=True)
    # After (this PR)
    map_view_mode: Literal["MODE_2D"] = Field("MODE_2D", alias="mapViewMode", const=True)
    apiVersion: Literal['v1'] = Field('v1', const=True)
    This is a bug fix that makes the generated code more type-safe, but downstream code performing type comparisons or using isinstance(field, str) checks may need adjustment. (#2864)

... (truncated)

Changelog

Sourced from datamodel-code-generator's changelog.

0.51.0 - 2026-01-01

Breaking Changes

Code Generation Changes

  • Different output when using --input-model with Set, FrozenSet, Mapping, or Sequence types - When using --input-model to convert Pydantic models or dataclasses, types that were previously converted to list or dict are now preserved as their original Python types. For example, a field typed as Set[str] now generates set[str] instead of list[str], FrozenSet[T] generates frozenset[T], Mapping[K, V] generates Mapping[K, V] instead of dict[K, V], and Sequence[T] generates Sequence[T] instead of list[T]. This may cause type checking differences or runtime behavior changes if your code depended on the previous output types. (#2837)
  • allOf multi-ref with property overrides now preserves inheritance - Schemas using allOf with multiple $ref items where the child schema also defines properties that override parent properties will now generate classes with multiple inheritance (e.g., class Person(Thing, Location)) instead of a flattened single class with all properties merged inline. Previously, child property overrides were incorrectly treated as conflicts, triggering schema merging. Users relying on the flattened output may need to adjust their code. (#2838) Before:
    class Person(BaseModel):
        type: str | None = 'playground:Person'
        name: constr(min_length=1) | None = None
        address: constr(min_length=5)
        age: int | None = None
    After:
    class Thing(BaseModel):
        type: str
        name: constr(min_length=1)
    class Location(BaseModel):
        address: constr(min_length=5)
    class Person(Thing, Location):
        type: str | None = 'playground:Person'
        name: constr(min_length=1) | None = None
        age: int | None = None
  • Ruff unsafe fixes now applied automatically - When using the ruff-check formatter, the --unsafe-fixes flag is now passed to ruff, which enables fixes that may change code behavior in potentially incorrect ways. This includes removing unused imports that might have side effects, removing unused variables that could affect debugging, and other transformations ruff considers "unsafe". Users who relied on the previous conservative safe-only fix behavior may see different generated code output. To restore the previous behavior, users can configure ruff via pyproject.toml or ruff.toml to disable specific unsafe rules. (#2847)
  • Type aliases now generate as class inheritance - When using --reuse-model (Pydantic v2 only), models that would previously generate as type aliases (ChildModel = ParentModel) now generate as explicit subclasses (class ChildModel(ParentModel): pass). This change improves type checker compatibility and maintains proper type identity, but may affect code that relied on type alias semantics or compared types directly. (#2853) Before:
    ArmLeft = ArmRight
    After:
    class ArmLeft(ArmRight):
        pass
  • Fields with const values in anyOf/oneOf now generate Literal types instead of inferred base types - Previously, a const value like "MODE_2D" in an anyOf/oneOf schema would generate str type. Now it generates Literal["MODE_2D"]. This change affects type hints in generated models and may require updates to code that type-checks against the generated output. For example:
    # Before (v0.x)
    map_view_mode: str = Field("MODE_2D", alias="mapViewMode", const=True)
    apiVersion: str = Field('v1', const=True)
    # After (this PR)
    map_view_mode: Literal["MODE_2D"] = Field("MODE_2D", alias="mapViewMode", const=True)
    apiVersion: Literal['v1'] = Field('v1', const=True)
    This is a bug fix that makes the generated code more type-safe, but downstream code performing type comparisons or using isinstance(field, str) checks may need adjustment. (#2864)

... (truncated)

Commits
  • 74cd08b Add release notification workflow (#2884)
  • 3f06fa4 Consolidate ParserConfig TypedDict profiles with inheritance preservation (#2...
  • 20ad1a1 Add pre-commit hook setup instructions to contributing guide (#2882)
  • 294acb6 Exclude OpenAPI/JSON Schema extension fields (x-*) (#2801)
  • 9dc9dd4 Add multiple --input-model support with inheritance preservation (#2881)
  • 36530b1 refactor: streamline parser configuration creation and enhance input handling...
  • efe8dfa fix: Always merge multiple GraphQL schemas before parsing (#2873)
  • 7486e2a Update using_as_module.md to document config parameter (#2879)
  • 9ef026e Refactor generate() and Parser to use config directly (#2878)
  • 0c5d538 Simplify Parser.init signature using Unpack[ParserConfigDict] (#2877)
  • 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 merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @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.50.0 to 0.51.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.50.0...0.51.0)

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

Signed-off-by: dependabot[bot] <[email protected]>
@dependabot dependabot bot added dependencies Related with project dependencies maintenance Package and maintenance related labels Jan 1, 2026
@dependabot dependabot bot requested a review from nezgrath as a code owner January 1, 2026 04:12
@dependabot dependabot bot added the dependencies Related with project dependencies label Jan 1, 2026
@dependabot dependabot bot added the maintenance Package and maintenance related label Jan 1, 2026
@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.19%. Comparing base (1b71e69) to head (d4ab22d).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #342   +/-   ##
=======================================
  Coverage   85.19%   85.19%           
=======================================
  Files          17       17           
  Lines        1628     1628           
=======================================
  Hits         1387     1387           
  Misses        241      241           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dependabot @github
Copy link
Contributor Author

dependabot bot commented on behalf of github Jan 5, 2026

Superseded by #346.

@dependabot dependabot bot closed this Jan 5, 2026
@dependabot dependabot bot deleted the dependabot/pip/datamodel-code-generator-0.51.0 branch January 5, 2026 04:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Related with project dependencies maintenance Package and maintenance related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants