Commit 5ea30a3
[v3-2-test] Fix TypeError in GET /dags/{dag_id}/tasks when order_by field has None values (apache#64384)
The tasks endpoint crashed with a 500 Internal Server Error when sorting
by a field (e.g. start_date) that contains None values, because Python 3
cannot compare None with None using '<'.
This adds explicit validation of the order_by parameter against a
whitelist of sortable fields (returning 400 for invalid fields, consistent
with SortParam used in other endpoints) and handles None values in the
sort key so nullable fields work correctly.
Closes: apache#63927
(cherry picked from commit 15cf396)
Co-authored-by: Antonio Mello <ajgcvm@gmail.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 51144dc commit 5ea30a3
2 files changed
Lines changed: 49 additions & 7 deletions
File tree
- airflow-core
- src/airflow/api_fastapi/core_api/routes/public
- tests/unit/api_fastapi/core_api/routes/public
Lines changed: 35 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
21 | 20 | | |
22 | 21 | | |
23 | 22 | | |
| |||
33 | 32 | | |
34 | 33 | | |
35 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
36 | 58 | | |
37 | 59 | | |
38 | 60 | | |
| |||
52 | 74 | | |
53 | 75 | | |
54 | 76 | | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
59 | 89 | | |
60 | 90 | | |
61 | 91 | | |
| |||
Lines changed: 14 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
543 | 543 | | |
544 | 544 | | |
545 | 545 | | |
546 | | - | |
547 | | - | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
548 | 549 | | |
549 | 550 | | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
550 | 562 | | |
551 | 563 | | |
552 | 564 | | |
| |||
0 commit comments