Skip to content

Bump datamodel-code-generator from 0.71.0 to 0.74.0 - #8

Open
dependabot[bot] wants to merge 1 commit into
mainfrom
dependabot/pip/datamodel-code-generator-0.74.0
Open

Bump datamodel-code-generator from 0.71.0 to 0.74.0#8
dependabot[bot] wants to merge 1 commit into
mainfrom
dependabot/pip/datamodel-code-generator-0.74.0

Conversation

@dependabot

@dependabot dependabot Bot commented on behalf of github Aug 23, 2026

Copy link
Copy Markdown

Bumps datamodel-code-generator from 0.71.0 to 0.74.0.

Release notes

Sourced from datamodel-code-generator's releases.

0.74.0

Breaking Changes

Code Generation Changes

  • Non-finite float values now render as structural float(...) expressions - Generated code for non-finite floats (inf, -inf, nan) from Protocol Buffers, XML Schema, and AsyncAPI-embedded schemas — as field defaults, constraint bounds, list items, and enum values — now renders inline as float('inf'), float('-inf'), and float('nan') instead of emitting bare inf/nan literals with an injected from math import inf, nan header. Users relying on the previous output (e.g. snapshot/golden tests, or importing inf/nan from the generated module) will see different generated code (#3770)
# Before
from math import inf
class Model(BaseModel):
value: float | None = inf
After
class Model(BaseModel):
value: float | None = float('inf')

What's Changed

New Contributors

Full Changelog: koxudaxi/datamodel-code-generator@0.73.0...0.74.0

0.73.0

Breaking Changes

Error Handling Changes

  • Additional imports are now validated as Python import paths - Values passed via --additional-imports, the Python config API (GenerateConfig, JSONSchemaParserConfig, etc.), or --extra-template-data must now be dotted sequences of Python identifiers. Previously any value was accepted and split on commas without validation; now inputs that are not valid import paths (e.g. containing newlines, semicolons, or non-identifier syntax) raise an Error and abort generation instead of being emitted into the generated output. Valid dotted paths (optionally whitespace-padded) continue to work unchanged. (#3763)
additional_imports must be a Python import path composed of identifiers: 'collections.deque\nINJECTION_MARKER = 1'

Default Behavior Changes

  • Reserved template keys in --extra-template-data now raise an error for built-in templates - When rendering a built-in (project-owned) template, supplying any generator-reserved key through --extra-template-data (or the extra_template_data API argument) now raises an Error and aborts generation instead of injecting the value. The reserved keys are class_body_lines, config_items, schema_runtime_validation, schema_runtime_validation_base_class_name, schema_runtime_validation_use_base, sequence_base_class, sequence_item_type, sequence_slice_type, _safe_config_items, typed_dict_kwargs, and typed_dict_kwargs_suffix. To inject raw code via these keys you must now use a custom root template through --custom-template-dir. (#3765)
  • Stricter extra_template_data validation - extra_template_data that is not a dictionary, contains non-string keys, or contains duplicate (normalized) keys now raises an Error rather than being silently accepted. (#3765)

Code Generation Changes

  • Built-in templates now serialize extra_template_data values as non-executing literals - For built-in templates, user-supplied values that were previously emitted as raw Python source are now serialized as quoted, non-executing literals. This affects GraphQL scalar py_type, TypedDict additionalPropertiesType, ConfigDict values, msgspec base_class_kwargs, and comments. Only bare or dotted identifiers (e.g. datetime.date) are still emitted unquoted; more complex expressions become string literals. For example, a scalar py_type supplied as a type expression is now rendered as:
Evil = TypeAliasType("Evil", "__import__('os').system('id') or str")

Trusted custom root templates (--custom-template-dir providing the root template) keep the previous unrestricted raw behavior. (#3765)

  • Include-only custom template directories no longer receive raw built-in context - "Custom root" detection changed from template_file_path.is_absolute() to _uses_custom_root_template. A --custom-template-dir that only supplies include/partial templates (not the model's root template) no longer opts the built-in root into the unrestricted raw-context path; its extra_template_data is now treated with the hardened built-in rules (and reserved keys raise an error). (#3765)

... (truncated)

Changelog

Sourced from datamodel-code-generator's changelog.

0.74.0 - 2026-08-17

Breaking Changes

Code Generation Changes

  • Non-finite float values now render as structural float(...) expressions - Generated code for non-finite floats (inf, -inf, nan) from Protocol Buffers, XML Schema, and AsyncAPI-embedded schemas — as field defaults, constraint bounds, list items, and enum values — now renders inline as float('inf'), float('-inf'), and float('nan') instead of emitting bare inf/nan literals with an injected from math import inf, nan header. Users relying on the previous output (e.g. snapshot/golden tests, or importing inf/nan from the generated module) will see different generated code (#3770)
# Before
from math import inf
class Model(BaseModel):
value: float | None = inf
After
class Model(BaseModel):
value: float | None = float('inf')

What's Changed

New Contributors

Full Changelog: koxudaxi/datamodel-code-generator@0.73.0...0.74.0


0.73.0 - 2026-08-15

Breaking Changes

Error Handling Changes

  • Additional imports are now validated as Python import paths - Values passed via --additional-imports, the Python config API (GenerateConfig, JSONSchemaParserConfig, etc.), or --extra-template-data must now be dotted sequences of Python identifiers. Previously any value was accepted and split on commas without validation; now inputs that are not valid import paths (e.g. containing newlines, semicolons, or non-identifier syntax) raise an Error and abort generation instead of being emitted into the generated output. Valid dotted paths (optionally whitespace-padded) continue to work unchanged. (#3763)
additional_imports must be a Python import path composed of identifiers: 'collections.deque\nINJECTION_MARKER = 1'

Default Behavior Changes

  • Reserved template keys in --extra-template-data now raise an error for built-in templates - When rendering a built-in (project-owned) template, supplying any generator-reserved key through --extra-template-data (or the extra_template_data API argument) now raises an Error and aborts generation instead of injecting the value. The reserved keys are class_body_lines, config_items, schema_runtime_validation, schema_runtime_validation_base_class_name, schema_runtime_validation_use_base, sequence_base_class, sequence_item_type, sequence_slice_type, _safe_config_items, typed_dict_kwargs, and typed_dict_kwargs_suffix. To inject raw code via these keys you must now use a custom root template through --custom-template-dir. (#3765)
  • Stricter extra_template_data validation - extra_template_data that is not a dictionary, contains non-string keys, or contains duplicate (normalized) keys now raises an Error rather than being silently accepted. (#3765)

Code Generation Changes

  • Built-in templates now serialize extra_template_data values as non-executing literals - For built-in templates, user-supplied values that were previously emitted as raw Python source are now serialized as quoted, non-executing literals. This affects GraphQL scalar py_type, TypedDict additionalPropertiesType, ConfigDict values, msgspec base_class_kwargs, and comments. Only bare or dotted identifiers (e.g. datetime.date) are still emitted unquoted; more complex expressions become string literals. For example, a scalar py_type supplied as a type expression is now rendered as:
</tr></table> 

... (truncated)

Commits

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.71.0 to 0.74.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.71.0...0.74.0)

---
updated-dependencies:
- dependency-name: datamodel-code-generator
  dependency-version: 0.74.0
  dependency-type: direct:development
  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 Pull requests that update python code labels Aug 23, 2026
@dependabot
dependabot Bot requested a review from ron1510 as a code owner August 23, 2026 19:26
@dependabot dependabot Bot added dependencies Pull requests that update a dependency file python Pull requests that update python code labels Aug 23, 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 python Pull requests that update python code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants