jens-scheffler-bosch commented on code in PR #31301:
URL: https://github.com/apache/airflow/pull/31301#discussion_r1213589242
##########
airflow/models/dag.py:
##########
@@ -685,8 +685,8 @@ def validate(self):
f"inconsistent schedule: timetable {self.timetable.summary!r} "
f"does not match schedule_interval {self.schedule_interval!r}",
)
- self.params.validate()
self.timetable.validate()
+ self.validate_schedule_and_params()
Review Comment:
Yes, and this two lines are the major driver for the change.
`self.params.validate()` checks all params for validity, *Always*. including
that default values are according to scheme. This fails if for example you have
a required field but you want to force the user to enter a value (and desire
the default to be None or empty).
The other call `self.validate_schedule_and_params()` actually does the same
but only conditionally if the DAG is automatically scheduled. Effect is that if
a DAG is automatically scheduled we need to have defaults validated according
to params JSON Schema. But otherwise if the DAG is _not_ scheduled we can leave
default non-compliant and validate params at time of trigger.
Why I change this here and how I changed it? Made the DAG parsing code
consistent with the constructor, which actually already did _THE_SAME_ checks
but inconsistent to before.
--
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]