-
Notifications
You must be signed in to change notification settings - Fork 16.5k
Description
Apache Airflow version
3.1.7
If "Other Airflow 3 version" selected, which one?
No response
What happened?
In Airflow 2.11 we use trigger forms with enum values in order to have users selecting a value with a choice. In Airflow 2.11 it was possible to also add a "null"/None value and make the field optional, also adding this to enum.
In Airflow 3 this fails rendering the form. This generates on the UI the error:
What you think should happen instead?
The empty default should be rendered. And it should be possible to pick a "null" value.
Note that workarounds seem to be impossible: If the "null" value is removed from the list of values in enum and the user clicks on the "x" icon in the dropdown the value is cleared, form submission fails though with HTTP 400 as an empty field value is not in the enum list and therefore invalid.
How to reproduce
Start airflow e.g. via breeze start-airflow --load-example-dags and modify the airflow-core/src/airflow/example_dags/example_params_ui_tutorial.py and make the normal example dropdown being an optional field:
"pick_with_label": Param(
3,
type=["number", "null"],
title="Select one Number",
description="With drop down selections you can also have nice display labels for the values.",
enum=[*range(1, 10), None],
values_display={
1: "One",
2: "Two",
3: "Three",
4: "Four - is like you take three and get one for free!",
5: "Five",
6: "Six",
7: "Seven",
8: "Eight",
9: "Nine",
},
section="Drop-Downs and selection lists",
),
Click on the UI to trigger the form and the error above is displayed.
Operating System
any
Versions of Apache Airflow Providers
any
Deployment
Official Apache Airflow Helm Chart
Deployment details
any
Anything else?
Tested on main as well as 3.1.7 but might be existing for a longer time already.
Are you willing to submit PR?
- Yes I am willing to submit a PR!
Code of Conduct
- I agree to follow this project's Code of Conduct