Apache Airflow version
2.6.1
What happened
I'm using array Params and sometimes want to provide no values.
The Param is configured with type=["array", "null"] and a default value (e.g. ["a", "b", "c"]). I would assume emptying the Param field would set an empty array or null in the generated configuration JSON, but instead Airflow sets the default value. I have to manually modify the generated configuration JSON to submit an empty array.
Normal usage:

Clearing the param field sets the default value:

I have to manually modify the generated configuration JSON:

What you think should happen instead
I expect Airflow to set an empty array or null value when a Param field is left empty (and null is set as Param type).
How to reproduce
import datetime
from airflow.decorators import dag, task
from airflow.exceptions import AirflowSkipException
from airflow.models import Param
@dag(
schedule=None,
start_date=datetime.datetime(2023, 1, 1),
params={
"demo": Param(
default=["a", "b", "c"],
type=["array", "null"],
)
},
)
def dagrun_conf():
@task
def print_params(params=None):
if params["demo"]:
print(params["demo"])
else:
raise AirflowSkipException("Nothing to do here")
print_params()
dagrun_conf()
Operating System
N/A
Versions of Apache Airflow Providers
No response
Deployment
Astronomer
Deployment details
No response
Anything else
No response
Are you willing to submit PR?
Code of Conduct
Apache Airflow version
2.6.1
What happened
I'm using
arrayParams and sometimes want to provide no values.The Param is configured with
type=["array", "null"]and a default value (e.g.["a", "b", "c"]). I would assume emptying the Param field would set an empty array or null in the generated configuration JSON, but instead Airflow sets the default value. I have to manually modify the generated configuration JSON to submit an empty array.Normal usage:

Clearing the param field sets the default value:

I have to manually modify the generated configuration JSON:

What you think should happen instead
I expect Airflow to set an empty array or null value when a Param field is left empty (and
nullis set as Param type).How to reproduce
Operating System
N/A
Versions of Apache Airflow Providers
No response
Deployment
Astronomer
Deployment details
No response
Anything else
No response
Are you willing to submit PR?
Code of Conduct