Params Definition is Required to be JSON Schema Valid also if Manually Triggered #31299
Closed
2 tasks done
Labels
affected_version:2.6
Issues Reported for 2.6
area:core
good first issue
type:improvement
Changelog: Improvements
Apache Airflow version
2.6.0
What happened
While trying to debug other things I stumbled over the function
DAG.validate_schedule_and_params()
which is used in the constructor of the DAG class. This function validates all DAGparams
for JSON Schema correctness - but only if the trigger condition is not set to manual. From point of code I understood that this is made especially to have a valid DAG but validateparams
at time of triggering.I tried to apply this as a "feature" in the Trigger UI Forms from AIP-50 and realized that DAG parsing in
dagbag.py:444
callsdag.validate()
which still does a full validation. So the DAG can not be rendered ifparams
are not valid against JSON Schema.What you think should happen instead
So if we have a manual triggered DAG it would be cool to relax
param
validation and check on submission. This would allow to define required fields and enforce a user to prove content w/o having a default and the user just hits "Trigger".Besides this it makes the constructor and the
dag.validate()
call consistent in regards of checks.How to reproduce
Run your Airflow instance and edit
airflow/example_dags/example_params_ui_tutorial.py
in line 108 for example and set the default value ofrequired_field
toNone
. You will get a DAG parsing error even the DAG is manually triggered.Operating System
Ubuntu 20.04
Versions of Apache Airflow Providers
defaults
Deployment
Official Apache Airflow Helm Chart
Deployment details
Standard Docker deployment of Airflow 2.6.0
Anything else
No response
Are you willing to submit PR?
Code of Conduct
The text was updated successfully, but these errors were encountered: