pierrejeambrun commented on code in PR #62160:
URL: https://github.com/apache/airflow/pull/62160#discussion_r2841984262


##########
airflow-core/src/airflow/api_fastapi/core_api/datamodels/dag_run.py:
##########
@@ -87,6 +87,54 @@ class DAGRunResponse(BaseModel):
     partition_key: str | None
 
 
+class DAGRunBaseResponse(BaseModel):
+    dag_run_id: str = Field(validation_alias="run_id")
+    dag_id: str
+    logical_date: datetime | None
+    queued_at: datetime | None
+    start_date: datetime | None
+    end_date: datetime | None
+    duration: float | None
+    data_interval_start: datetime | None
+    data_interval_end: datetime | None
+    run_after: datetime
+    last_scheduling_decision: datetime | None
+    run_type: DagRunType
+    state: DagRunState
+    triggered_by: DagRunTriggeredByType | None
+    triggering_user_name: str | None
+    conf: dict | None
+    note: str | None
+    bundle_version: str | None
+    dag_display_name: str = Field(validation_alias=AliasPath("dag_model", 
"dag_display_name"))
+    partition_key: str | None
+
+
+class DAGRunListResponse(DAGRunBaseResponse):
+    created_dag_version_obj: DagVersionResponse | None = Field(
+        default=None,
+        validation_alias="created_dag_version",
+        exclude=True,
+    )
+
+    @computed_field(return_type=list[DagVersionResponse])
+    def dag_versions(self) -> list[DagVersionResponse]:
+        dv = self.created_dag_version_obj
+        if not dv:
+            return []
+
+        # Non-versioned DAGs must not expose versions
+        if dv.bundle_name is None:
+            return []
+
+        return [dv]
+        

Review Comment:
   This is more or less not consistent with what we have today, can you explain 
why you are not returning the `dag_versions` object from the model but the 
'created_dag_version" ? 
   
   This is breaking the public API (this information is helpful for the UI and 
it's part of the public API)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to