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

   ### Apache Airflow version
   
   2.10.1
   
   ### If "Other Airflow 2 version" selected, which one?
   
   _No response_
   
   ### What happened?
   
   Using a DAG Param with a type of `object` and `enum` set to a list of 
possible objects is reflected as a string in Trigger DAG UI, both in the 
selector and in the underlying JSON.
   
![image](https://github.com/user-attachments/assets/23f4c62b-6bc7-4e4d-bb8e-eadb322e8a54)
   
   When attempting to run the DAG using the value, the DAG will fail to run
   
![image](https://github.com/user-attachments/assets/191486b2-2ef5-4eaf-9523-482a6377204a)
   
   
   ### What you think should happen instead?
   
   JSON schemas support enums of any type 
   
   > Elements in the array might be of any type, including null.
   
   (source: 
https://json-schema.org/draft/2020-12/json-schema-validation#section-6.1.2-3) . 
They should be configurable and supported by DAG Parameters, and should allow 
for successful selection and execution of the DAG from the Trigger DAG UI.
   
   ### How to reproduce
   
   Create the following DAG
   ```python
   from airflow.decorators import dag, task
   from pendulum import datetime
   from airflow.models.param import Param
   
   keys = ["a", "b", "c"]
   values_display_list = [{"key": key, "value": key.upper()} for key in keys]
   
   
   @dag(
       start_date=datetime(2024, 1, 1),
       schedule=None,
       catchup=False,
       params={
           "x": Param(
               values_display_list[0],
               type=["object"],
               enum=values_display_list,
           ),
       },
       tags=["example"],
   )
   def example_params():
       @task
       def example_params_task(*, params, **kwargs) -> None:
           if params:
               print(f"Params: {params}")
           else:
               print("No Params")
   
       example_params_task()
   
   
   # Instantiate the DAG
   example_params()
   ```
   
   
   
   ### Operating System
   
   Debian 12 (Bookworm)
   
   ### Versions of Apache Airflow Providers
   
   apache-airflow==2.10.1+astro.1
   
   ### Deployment
   
   Other Docker-based deployment
   
   ### Deployment details
   
   Astro CLI running Astro Runtime 12.1.0
   
   ### Anything else?
   
   I think this issue might be caused by the the trigger templating at 
https://github.com/apache/airflow/blob/2.10.2/airflow/www/templates/airflow/trigger.html#L77-L86
   
   ### 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