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

   ### Apache Airflow version
   
   Other Airflow 2 version (please specify below)
   
   ### If "Other Airflow 2 version" selected, which one?
   
   2.7.3
   
   ### What happened?
   
   In the Trigger DAG end point, using the DAG conf Parameters form will 
incorrectly convert a boolean to a string when the parameter type is defined as:
   ```
   Param(
                   default=None,
                   type=["boolean", "null"],
               ),
   ```
   
   This can be seen by comparing the value in the field to what is produced in 
the generated JSON config
   
![image](https://github.com/apache/airflow/assets/6698936/60b8ed04-da77-4446-9289-987d4e2ad799)
   
   If this JSON configuration is submitted, then the validation will raise an 
error because "True" is not a valid boolean
   
![image](https://github.com/apache/airflow/assets/6698936/3ddd9848-c22a-430b-ad88-9fa85f2a4947)
   
   
   Note for comparison, the "use_ndssr" field is defined as:
   ```
   Param(
                   default=False,
                   type="boolean"
   ```
   works as expected: the JSON config has a valid JSON boolean type and it 
passes the parameter validation.
   
   ### What you think should happen instead?
   
   When a parameter is defined as a union of boolean and null (like below), the 
DAG Conf Parameters form should generate a value in the Generated JSON config 
that is a boolean.
   ```
   Param(
                   default=None,
                   type=["boolean", "null"],
               ),
   ```
   
   It should be:
   ```
   {
       "parameter_name": true
   }
   ```
   instead of 
   ```
   {
       "parameter_name": "True"
   }
   ```
   
   ### How to reproduce
   
   1. Create a DAG that has a parameter with these types:
   
   ```
   Param(
                   default=None,
                   type=["boolean", "null"],
               ),
   ```
   
   2. Navigate to the Trigger DAG Run for that DAG
   3. Add a value of true or false in the DAG Conf Parameters form
   4. Note the value in the Generated JSON config has quotes
   5. Press submit, and see an error message like:
   
![image](https://github.com/apache/airflow/assets/6698936/af9344b8-1be4-46d9-a69d-2af6afed17bd)
   
   
   ### Operating System
   
   Ubuntu
   
   ### Versions of Apache Airflow Providers
   
   _No response_
   
   ### Deployment
   
   Other Docker-based deployment
   
   ### Deployment details
   
   _No response_
   
   ### Anything else?
   
   This issue occurs every time the DAG Conf parameter form is used and there 
is at least one parameter defined like:
   ```
   Param(
                   default=None,
                   type=["boolean", "null"],
               ),
   ```
   
   
   This issue can be worked around by directly updating the value in Generated 
JSON configuration after a value has been added in the form:
   
![image](https://github.com/apache/airflow/assets/6698936/b19a8d59-17c6-4fbe-8fb7-fdd049bf89b8)
   
   Based off a similar [issue](https://github.com/apache/airflow/issues/31930) 
and subsequent 
[resolution](https://github.com/apache/airflow/pull/31980/commits), updates are 
likely needed in (or around) `airflow/www/templates/airflow/trigger.html
   
   
   ### 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