abhishekbhakat commented on code in PR #58111:
URL: https://github.com/apache/airflow/pull/58111#discussion_r2523361911
##########
airflow-core/src/airflow/serialization/serialized_objects.py:
##########
@@ -2107,6 +2112,9 @@ def _deserialize_field_value(cls, field_name: str, value:
Any) -> Any:
elif field_name == "resources":
return Resources.from_dict(value) if value is not None else None
elif field_name.endswith("_date"):
+ # Skip deserialization for strings containing Jinja templates
+ if isinstance(value, str) and cls._contains_jinja(value):
+ return value # Keep as-is for runtime rendering
Review Comment:
check `test_dag_validation_string_dates.py`
The `BarOperator` has `start_date` and `end_date` as instance attributes
(which are in `template_fields`), and they contain Jinja templates like `"{{
(data_interval_start - macros.timedelta(days=11)).strftime('%Y-%m-%d') }}"`.
I can limit it to check only Top-level date fields (DAG.start_date,
DAG.end_date, BaseOperator.start_date, BaseOperator.end_date) if that's
preferred.
--
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]