diff --git a/airflow-core/src/airflow/api_fastapi/core_api/routes/ui/structure.py b/airflow-core/src/airflow/api_fastapi/core_api/routes/ui/structure.py index 25c8134203b4d..a84f36ab010d3 100644 --- a/airflow-core/src/airflow/api_fastapi/core_api/routes/ui/structure.py +++ b/airflow-core/src/airflow/api_fastapi/core_api/routes/ui/structure.py @@ -138,9 +138,9 @@ def structure_data( asset_expression, entry_node_ref["id"] ) data["nodes"] += upstream_asset_nodes - data["edges"] = upstream_asset_edges + data["edges"] += upstream_asset_edges - data["edges"] += start_edges + edges + end_edges + data["edges"] += start_edges + end_edges bind_output_assets_to_tasks(data["edges"], serialized_dag) diff --git a/airflow-core/tests/unit/api_fastapi/core_api/routes/ui/test_structure.py b/airflow-core/tests/unit/api_fastapi/core_api/routes/ui/test_structure.py index 035721a1dcbe4..2c6425db1b395 100644 --- a/airflow-core/tests/unit/api_fastapi/core_api/routes/ui/test_structure.py +++ b/airflow-core/tests/unit/api_fastapi/core_api/routes/ui/test_structure.py @@ -310,6 +310,20 @@ def test_should_return_200_with_asset(self, test_client, asset1_id, asset2_id, a } expected = { "edges": [ + { + "is_setup_teardown": None, + "label": None, + "source_id": "external_task_sensor", + "target_id": "task_2", + "is_source_asset": None, + }, + { + "is_setup_teardown": None, + "label": None, + "source_id": "task_1", + "target_id": "external_task_sensor", + "is_source_asset": None, + }, { "is_setup_teardown": None, "label": None, @@ -352,20 +366,6 @@ def test_should_return_200_with_asset(self, test_client, asset1_id, asset2_id, a "target_id": "task_1", "is_source_asset": None, }, - { - "is_setup_teardown": None, - "label": None, - "source_id": "external_task_sensor", - "target_id": "task_2", - "is_source_asset": None, - }, - { - "is_setup_teardown": None, - "label": None, - "source_id": "task_1", - "target_id": "external_task_sensor", - "is_source_asset": None, - }, { "is_setup_teardown": None, "label": None,