francescomucio commented on code in PR #25509:
URL: https://github.com/apache/airflow/pull/25509#discussion_r937334817
##########
airflow/models/dag.py:
##########
@@ -522,7 +522,7 @@ def __init__(
self.has_on_success_callback = self.on_success_callback is not None
self.has_on_failure_callback = self.on_failure_callback is not None
- self.doc_md = doc_md
+ self.doc_md = pathlib.Path(doc_md).read_text() if
pathlib.Path(str(doc_md or '')).is_file() else doc_md
Review Comment:
Uhm... it looks like it is a jinja2 feature and trying to get_template_env
with something like this:
```python
def get_doc_md(self, doc_md: str) -> str:
if doc_md is None or not doc_md.endswith('.md'):
return doc_md
env = self.get_template_env(force_sandboxed=False)
return env.loader.get_source(env, doc_md)
```
gives me a weird error
```
Broken DAG: [/files/dags/dag.py] Traceback (most recent call last):
File "/opt/airflow/airflow/serialization/serialized_objects.py", line 286,
in validate_schema
cls._json_schema.validate(serialized_obj)
File "/usr/local/lib/python3.7/site-packages/jsonschema/validators.py",
line 353, in validate
raise error
jsonschema.exceptions.ValidationError:
```
Followed by the content of my `.md` file
--
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]