opeida opened a new issue, #51977:
URL: https://github.com/apache/airflow/issues/51977
### Apache Airflow version
3.0.2
### If "Other Airflow 2 version" selected, which one?
_No response_
### What happened?
Default parameter is ignored by dag.params.get() when the parameter is
defined. `dag.params.get('my_list', [])` returns `None` instead of `[]` foe the
following parameter:
``` python
params={
"my_list": Param(
default=None,
type=["null", "array"],
items={
"type": "string",
},
),
}
```
### What you think should happen instead?
The function should return `[]`.
### How to reproduce
```python
import logging
from airflow.sdk import DAG, Param, task
logger = logging.getLogger(__name__)
with DAG(
"test_dag",
schedule=None,
params={
"my_list": Param(
default=None,
type=["null", "array"],
items={
"type": "string",
},
),
}
) as dag:
@task
def test_task():
logger.info(dag.params.get('my_list', [])) # Defined param, returns
None
logger.info(dag.params.get('absent_list', [])) # Undefined param,
returns []
test_task()
if __name__ == "__main__":
dag.test()
```
### Operating System
Debian GNU/Linux 12 (bookworm)
### Versions of Apache Airflow Providers
apache-airflow-providers-celery==3.11.0
apache-airflow-providers-common-compat==1.7.0
apache-airflow-providers-common-io==1.6.0
apache-airflow-providers-common-sql==1.27.1
apache-airflow-providers-fab==2.2.0
apache-airflow-providers-google==15.1.0
apache-airflow-providers-http==5.3.0
apache-airflow-providers-postgres==6.2.0
apache-airflow-providers-redis==4.1.0
apache-airflow-providers-smtp==2.1.0
apache-airflow-providers-standard==1.2.0
### Deployment
Other Docker-based deployment
### Deployment details
Extended image based on `apache/airflow:slim-3.0.2-python3.12`
### 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]