nyoungstudios opened a new issue, #56915:
URL: https://github.com/apache/airflow/issues/56915
### Apache Airflow version
Other Airflow 2/3 version (please specify below)
### If "Other Airflow 2/3 version" selected, which one?
2.10.5
### What happened?
Triggering a DAG in the Airflow UI doesn't work if the there is a Param with
type `object` and a default value of `{}`. You can still trigger the same DAG
with the Airflow API or from another DAG just fine.
It was working in Airflow 2.10.2. I haven't tried other Airflow versions yet.
### What you think should happen instead?
You should be able to successfully trigger a DAG with a Param of type
`object` and a default value of `{}` in the Airflow UI .
### How to reproduce
```python
from airflow.models import DAG, Param
from airflow.operators.python import PythonOperator
def print_params(**context):
print(context)
print(context["params"])
with DAG(
dag_id="object_params_example",
schedule_interval=None,
description="Testing object params",
params={
"object_with_empty_default": Param({}, type="object", description="a
description of a param"),
},
) as dag:
PythonOperator(
task_id="print-params",
python_callable=print_params,
)
```
Triggering this DAG in the UI doesn't work. And it should let us trigger a
DAG here since an empty dictionary is indeed a valid JSON schema object.
<img width="2086" height="752" alt="Image"
src="https://github.com/user-attachments/assets/34eeb0a5-574f-4ab7-940c-bb84beaae01b"
/>
And here is the output in the Chrome console:
<img width="1914" height="310" alt="Image"
src="https://github.com/user-attachments/assets/9a4d4b98-21fd-43c7-91fa-631b68df9096"
/>
Even if we type in an input into the text box, it doesn't work either.
Also, if we change the param in the DAG to this, it also doesn't work (of
course, adding an input before triggering):
```python
"object_with_default_none": Param(None, type="object", description="a
description of a param"),
```
If we change the param to this, it works fine:
```python
"object_with_non_empty_default": Param({"key": "value"}, type="object",
description="a description of a param"),
```
This also works just fine:
```python
"object_optional_no_default": Param(None, type=["null", "object"],
description="a description of a param"),
```
And all of these work fine if called from the API or another DAG using the
TriggerDagRunOperator.
### Operating System
Linux, Ubuntu 20.04 LTS and Ubuntu 24.04 LTS
### Versions of Apache Airflow Providers
Doesn't matter
### Deployment
Google Cloud Composer
### Deployment details
Deployment doesn't matter. Also fails with locally installed Airflow version
from pip.
### 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]