jscheffl opened a new issue, #62049:
URL: https://github.com/apache/airflow/issues/62049

   ### 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:
   
   <img width="526" height="273" alt="Image" 
src="https://github.com/user-attachments/assets/5eaca414-adf0-4765-b716-3d6e9ff5f6a4";
 />
   
   ### 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
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


-- 
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