matteoannotell opened a new issue, #33923:
URL: https://github.com/apache/airflow/issues/33923
### Apache Airflow version
2.7.0
### What happened
When initialising integer parameters as 0, or arrays as empty list, the
default behaviour of the UI is to render it as null.
This results in default parameters being ignored unless re-imputed manually.
Passing a config like this:
````
params={
"integer_param": Param(0, type="integer", minimum=0),
"list_param": Param([], type="array"),
},
````
results in this in the UI when the DAG loads, forcing the user to manually
input again 0, or editing the json for having an empty list
<img width="1699" alt="image"
src="https://github.com/apache/airflow/assets/111278183/e0722be8-1806-4cf0-85b3-ec422c8f96a7">
<img width="371" alt="image"
src="https://github.com/apache/airflow/assets/111278183/f9670f83-5d29-48f5-a8ad-7e4432c1ba47">
### What you think should happen instead
0 rendered as 0, empty lists as empty lists
### How to reproduce
This DAG should be an MVP for reproducing the error
````
from datetime import datetime
from airflow import DAG
from airflow.models.param import Param
from airflow.operators.python_operator import PythonOperator
default_args = {
"owner": "data-enablement",
"start_date": datetime(2023, 4, 24),
"retries": 30,
"startup_timeout_seconds": 600,
}
with DAG(
"test-error",
default_args=default_args,
schedule=None,
params={
"integer_param": Param(0, type="integer", minimum=0),
"list_param": Param([], type="array"),
},
render_template_as_native_obj=True,
description="MVP for reproducing error",
) as dag:
print_int_task = (
PythonOperator(
task_id="print_int",
op_args=[
"{{ params.integer_param}}",
],
python_callable=(lambda integer_param: print(integer_param)),
),
)
print_list_task = PythonOperator(
task_id="print_list",
op_args=[
"{{ params.list_param}}",
],
python_callable=(lambda list_param: print(list_param)),
)
print_int_task, print_list_task
`````
### Operating System
macOS M1 locally
### Versions of Apache Airflow Providers
_No response_
### Deployment
Docker-Compose
### Deployment details
Using this image:
https://hub.docker.com/layers/apache/airflow/2.7.0-python3.10/images/sha256-d6cb37572c21546ba3e60274d3cc1e782cc517a31443b8051702b19584e7379b?context=explore
### Anything else
_No response_
### 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]