SamWheating opened a new pull request, #33965:
URL: https://github.com/apache/airflow/pull/33965

   Re: https://github.com/apache/airflow/issues/33923
   
   Pretty self explanatory, since python's zero is falsey, using `{% if 
form.details.value %}` led to the default value being omitted if it was a zero. 
This minor change makes a zero default value explicitly zero, and if a user 
wants to default to null they can use something like:
   
   ```python
   Param(None, type=["integer", "null"])
   ```
   
   So given the following DAG:
   ```python
   with DAG(
       "params-dag",
       schedule=None,
       params={
           "integer_param": Param(5, type="integer"),
           "zero_integer_param": Param(0, type="integer"),
           "unset_integer_param": Param(None, type=["integer", "null"]),
       },
   ) as dag:
   ```
   
   This was the default form before:
   <img width="1875" alt="image" 
src="https://github.com/apache/airflow/assets/16950874/741e86f1-58db-47e9-99a0-f8c2f1516271";>
   
   And this is it after:
   <img width="1892" alt="image" 
src="https://github.com/apache/airflow/assets/16950874/ce4fa7d9-e5c5-4a00-b293-b438b7da2784";>
   
   List-type args are a whole different problem, and there's a lot of 
discussion in the original issue, so lets leave that for another PR? In the 
current implementation there's no way to explicitly pass an empty list through 
the form interface so I think that some changes will be definitely be required.
   


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