Skip to content

Exploring possibility of moving DagAttributeTypes to execution API spec#61251

Merged
amoghrajesh merged 2 commits intoapache:mainfrom
astronomer:decouple-serialization-enums
Feb 4, 2026
Merged

Exploring possibility of moving DagAttributeTypes to execution API spec#61251
amoghrajesh merged 2 commits intoapache:mainfrom
astronomer:decouple-serialization-enums

Conversation

@amoghrajesh
Copy link
Copy Markdown
Contributor


Was generative AI tooling used to co-author this PR?
  • No

Ok hear me out, this might be odd, but since its just one enum it didn't feel too wrong.

Instead of creating a shared library or duplicating the enum, we expose DagAttributeTypes through the Execution API's OpenAPI schema. This allows the Task SDK to get the enum values via code generation, keeping SDK and core serialization protocol in sync automatically.

Why this approach:

  • SDK only needs 2 values (OP, TASK_GROUP) from the 30+ value DagAttributeTypes enum
  • Adding a shared library felt heavyweight for just 2 string constants
  • Hardcoding risked typos whcih could lead to broken contract
  • OpenAPI schema generation provides automatic sync mechanism

The DagAttributeTypes enum is added to get_extra_schemas() and exposed in the API spec. When task-sdk regenerates its models, it gets a properly typed enum that matches what core expects for serialize_for_task_group()

Trade-off: This enum isn't actually used in API requests/responses - it's purely for the serialization. However, since we already generate SDK models from the API spec and need these exact values there, reusing the generation mechanism felt pragmatic.

I considered the alternative of creating shared/serialization library but it deemed overkill for 2 values used in few places.


  • Read the Pull Request Guidelines for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
  • For fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
  • When adding dependency, check compliance with the ASF 3rd Party License Policy.
  • For significant user-facing changes create newsfragment: {pr_number}.significant.rst or {issue_number}.significant.rst, in airflow-core/newsfragments.

@amoghrajesh amoghrajesh requested a review from sunank200 January 30, 2026 10:51
@amoghrajesh amoghrajesh requested a review from uranusjr January 30, 2026 10:51
@amoghrajesh amoghrajesh self-assigned this Jan 30, 2026
@amoghrajesh amoghrajesh added this to the Airflow 3.2.0 milestone Jan 30, 2026
@amoghrajesh amoghrajesh requested a review from potiuk January 30, 2026 10:51
Comment thread airflow-core/src/airflow/api_fastapi/execution_api/app.py
@amoghrajesh amoghrajesh requested a review from uranusjr February 2, 2026 11:15
@amoghrajesh
Copy link
Copy Markdown
Contributor Author

@uranusjr could i request a re review on this one?

@amoghrajesh amoghrajesh merged commit 2090656 into apache:main Feb 4, 2026
129 checks passed
@amoghrajesh amoghrajesh deleted the decouple-serialization-enums branch February 4, 2026 12:13
Alok-kumar-priyadarshi pushed a commit to Alok-kumar-priyadarshi/airflow that referenced this pull request Feb 5, 2026
jhgoebbert pushed a commit to jhgoebbert/airflow_Owen-CH-Leung that referenced this pull request Feb 8, 2026
Ratasa143 pushed a commit to Ratasa143/airflow that referenced this pull request Feb 15, 2026
choo121600 pushed a commit to choo121600/airflow that referenced this pull request Feb 22, 2026
Subham-KRLX pushed a commit to Subham-KRLX/airflow that referenced this pull request Mar 4, 2026
Ankurdeewan pushed a commit to Ankurdeewan/airflow that referenced this pull request Mar 15, 2026
radhwene pushed a commit to radhwene/airflow that referenced this pull request Mar 21, 2026
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.

2 participants