This is an automated email from the ASF dual-hosted git repository.
weilee pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new bc1bf437172 fix(api): allow null dag_run_conf in BackfillResponse
serialization (#63259)
bc1bf437172 is described below
commit bc1bf43717277285dba19d7c929143ae3b4bab18
Author: Yoann <[email protected]>
AuthorDate: Tue Mar 17 03:01:25 2026 -0700
fix(api): allow null dag_run_conf in BackfillResponse serialization (#63259)
Co-authored-by: Wei Lee <[email protected]>
---
.../src/airflow/api_fastapi/core_api/datamodels/backfills.py | 2 +-
.../airflow/api_fastapi/core_api/openapi/_private_ui.yaml | 6 ++++--
.../api_fastapi/core_api/openapi/v2-rest-api-generated.yaml | 6 ++++--
.../src/airflow/ui/openapi-gen/requests/schemas.gen.ts | 11 +++++++++--
.../src/airflow/ui/openapi-gen/requests/types.gen.ts | 4 ++--
.../api_fastapi/core_api/routes/public/test_backfills.py | 12 ++++++++++++
airflow-ctl/src/airflowctl/api/datamodels/generated.py | 2 +-
7 files changed, 33 insertions(+), 10 deletions(-)
diff --git
a/airflow-core/src/airflow/api_fastapi/core_api/datamodels/backfills.py
b/airflow-core/src/airflow/api_fastapi/core_api/datamodels/backfills.py
index b62622d746b..87d2677028e 100644
--- a/airflow-core/src/airflow/api_fastapi/core_api/datamodels/backfills.py
+++ b/airflow-core/src/airflow/api_fastapi/core_api/datamodels/backfills.py
@@ -46,7 +46,7 @@ class BackfillResponse(BaseModel):
dag_id: str
from_date: datetime
to_date: datetime
- dag_run_conf: dict
+ dag_run_conf: dict | None
is_paused: bool
reprocess_behavior: ReprocessBehavior
max_active_runs: int
diff --git
a/airflow-core/src/airflow/api_fastapi/core_api/openapi/_private_ui.yaml
b/airflow-core/src/airflow/api_fastapi/core_api/openapi/_private_ui.yaml
index 96a383b7299..50e3d75bbdd 100644
--- a/airflow-core/src/airflow/api_fastapi/core_api/openapi/_private_ui.yaml
+++ b/airflow-core/src/airflow/api_fastapi/core_api/openapi/_private_ui.yaml
@@ -1421,8 +1421,10 @@ components:
format: date-time
title: To Date
dag_run_conf:
- additionalProperties: true
- type: object
+ anyOf:
+ - additionalProperties: true
+ type: object
+ - type: 'null'
title: Dag Run Conf
is_paused:
type: boolean
diff --git
a/airflow-core/src/airflow/api_fastapi/core_api/openapi/v2-rest-api-generated.yaml
b/airflow-core/src/airflow/api_fastapi/core_api/openapi/v2-rest-api-generated.yaml
index 0bf32749927..17c4f87a6e4 100644
---
a/airflow-core/src/airflow/api_fastapi/core_api/openapi/v2-rest-api-generated.yaml
+++
b/airflow-core/src/airflow/api_fastapi/core_api/openapi/v2-rest-api-generated.yaml
@@ -9266,8 +9266,10 @@ components:
format: date-time
title: To Date
dag_run_conf:
- additionalProperties: true
- type: object
+ anyOf:
+ - additionalProperties: true
+ type: object
+ - type: 'null'
title: Dag Run Conf
is_paused:
type: boolean
diff --git a/airflow-core/src/airflow/ui/openapi-gen/requests/schemas.gen.ts
b/airflow-core/src/airflow/ui/openapi-gen/requests/schemas.gen.ts
index 1be05b11908..f47aa107aea 100644
--- a/airflow-core/src/airflow/ui/openapi-gen/requests/schemas.gen.ts
+++ b/airflow-core/src/airflow/ui/openapi-gen/requests/schemas.gen.ts
@@ -494,8 +494,15 @@ export const $BackfillResponse = {
title: 'To Date'
},
dag_run_conf: {
- additionalProperties: true,
- type: 'object',
+ anyOf: [
+ {
+ additionalProperties: true,
+ type: 'object'
+ },
+ {
+ type: 'null'
+ }
+ ],
title: 'Dag Run Conf'
},
is_paused: {
diff --git a/airflow-core/src/airflow/ui/openapi-gen/requests/types.gen.ts
b/airflow-core/src/airflow/ui/openapi-gen/requests/types.gen.ts
index e6c208c6393..9ebcb1278c9 100644
--- a/airflow-core/src/airflow/ui/openapi-gen/requests/types.gen.ts
+++ b/airflow-core/src/airflow/ui/openapi-gen/requests/types.gen.ts
@@ -138,8 +138,8 @@ export type BackfillResponse = {
from_date: string;
to_date: string;
dag_run_conf: {
- [key: string]: unknown;
- };
+ [key: string]: unknown;
+} | null;
is_paused: boolean;
reprocess_behavior: ReprocessBehavior;
max_active_runs: number;
diff --git
a/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_backfills.py
b/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_backfills.py
index 0bc9edd41e3..10bfd0f7817 100644
---
a/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_backfills.py
+++
b/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_backfills.py
@@ -176,6 +176,18 @@ class TestGetBackfill(TestBackfillEndpoint):
"updated_at": mock.ANY,
}
+ def test_get_backfill_with_null_conf(self, session, test_client):
+ """dag_run_conf can be NULL in the DB; the API should still serialize
it."""
+ (dag,) = self._create_dag_models()
+ from_date = timezone.utcnow()
+ to_date = timezone.utcnow()
+ backfill = Backfill(dag_id=dag.dag_id, from_date=from_date,
to_date=to_date, dag_run_conf=None)
+ session.add(backfill)
+ session.commit()
+ response = test_client.get(f"/backfills/{backfill.id}")
+ assert response.status_code == 200
+ assert response.json()["dag_run_conf"] is None
+
def test_no_exist(self, session, test_client):
response = test_client.get(f"/backfills/{231984098}")
assert response.status_code == 404
diff --git a/airflow-ctl/src/airflowctl/api/datamodels/generated.py
b/airflow-ctl/src/airflowctl/api/datamodels/generated.py
index fde516ef5c7..bb375f88834 100644
--- a/airflow-ctl/src/airflowctl/api/datamodels/generated.py
+++ b/airflow-ctl/src/airflowctl/api/datamodels/generated.py
@@ -1127,7 +1127,7 @@ class BackfillResponse(BaseModel):
dag_id: Annotated[str, Field(title="Dag Id")]
from_date: Annotated[datetime, Field(title="From Date")]
to_date: Annotated[datetime, Field(title="To Date")]
- dag_run_conf: Annotated[dict[str, Any], Field(title="Dag Run Conf")]
+ dag_run_conf: Annotated[dict[str, Any] | None, Field(title="Dag Run
Conf")] = None
is_paused: Annotated[bool, Field(title="Is Paused")]
reprocess_behavior: ReprocessBehavior
max_active_runs: Annotated[int, Field(title="Max Active Runs")]