Skip to content

Bump datamodel-code-generator pin from 0.33.0 to 0.41.0#69854

Open
harishkesavarao wants to merge 1 commit into
apache:mainfrom
harishkesavarao:datamodel-code-generator-deps
Open

Bump datamodel-code-generator pin from 0.33.0 to 0.41.0#69854
harishkesavarao wants to merge 1 commit into
apache:mainfrom
harishkesavarao:datamodel-code-generator-deps

Conversation

@harishkesavarao

@harishkesavarao harishkesavarao commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Bumps the datamodel-code-generator pin used by the task-sdk and airflow-ctl codegen uv dependency groups from 0.33.0 to 0.41.0. Both groups share a single workspace lockfile, so the pin must move together across task-sdk/pyproject.toml and airflow-ctl/pyproject.toml.

Why 0.41.0

Dependabot PR #68816 tried to bump this dependency and was closed. Regenerating the OpenAPI-derived model files with newer generator releases is not a no-op. Bisecting versions between 0.33.0 and 0.67.0 (see #69616, item 3) found:

  • 0.42.2 through 0.67.0: widen JsonValue-backed fields (e.g. in AssetResponse.extra, XComResponse.value) to JsonValue | None — a schema/type change.
  • 0.57.0 and later (regression compounds on top of the above): drop the = None default from nullable-but-not-required fields on ~200 fields across task-sdk/src/airflow/sdk/api/datamodels/_generated.py and airflow-ctl/src/airflowctl/api/datamodels/generated.py, turning previously-optional constructor arguments into required ones — a breaking Pydantic v2 model-contract change, even though use-default=true is set in both [tool.datamodel-codegen] configs.
  • 0.41.0 is the newest version that regenerates both clients with a diff limited to the generator version-comment line, plus one benign RootModel[list]RootModel[list[Any]] typing improvement in airflow-ctl's generated.py. No field lost its default, no type was widened.

Testing was done across several versions between 0.33.0 and 0.57.0 to identify where the change of behaviour occurs.

Testing

  • uv.lock regenerated cleanly: uv lock resolves 949 packages with datamodel-code-generator v0.33.0 -> v0.41.0, no conflicts between the task-sdk and airflow-ctl codegen groups.
  • Regenerated all three OpenAPI-derived client files and diffed against the pre-bump versions:
    • task-sdk/src/airflow/sdk/api/datamodels/_generated.py — version-comment line only.
    • airflow-ctl/src/airflowctl/api/datamodels/generated.py — version-comment line + RootModel[list]RootModel[list[Any]] (2 occurrences, semantically equivalent).
    • airflow-ctl/src/airflowctl/api/datamodels/auth_generated.py — version-comment line only.
  • task-sdk test suite: 2703 passed, 6 skipped (pre-existing, unrelated skips: non-Linux-only test, pyiceberg version mismatch, pendulum~=2 cases).
  • airflow-ctl test suite: 267 passed.
  • prek run --from-ref upstream/main --stage pre-commit: all applicable hooks passed, including mypy-task-sdk, mypy-devel-common, ruff lint/format, and Update uv.lock.

closes: #69616


Was generative AI tooling used to co-author this PR?
  • Yes — Claude Code (Sonnet 5)

The pin was stuck at 0.33.0 because later releases change how
use-default interacts with nullable/optional fields. Versions 0.42.2
through at least 0.67.0 widen JsonValue-backed fields to
JsonValue | None, and 0.57.0+ additionally drops the = None default
from nullable-optional fields, turning ~200 fields in the Task SDK
Execution API client and the airflow-ctl API client from optional
into required -- a breaking Pydantic v2 model-contract change.

0.41.0 is the newest release that still regenerates both clients with
a diff limited to the generator version-comment line (plus one benign
RootModel[list] -> RootModel[list[Any]] typing improvement in
airflow-ctl's generated.py), so it unblocks the dependency without
carrying either regression forward.

Closes the datamodel-code-generator item from apache#69616.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deliberate upgrades needed for Dependabot-capped deps: aiosqlite, fastapi/cadwyn, datamodel-code-generator

1 participant