uranusjr commented on a change in pull request #19758:
URL: https://github.com/apache/airflow/pull/19758#discussion_r763707903
##########
File path: airflow/api_connexion/endpoints/dag_endpoint.py
##########
@@ -88,25 +88,67 @@ def get_dags(limit, session, offset=0, only_active=True,
tags=None, dag_id_patte
@provide_session
def patch_dag(session, dag_id, update_mask=None):
"""Update the specific DAG"""
+ try:
+ patch_body = dag_schema.load(request.json, session=session)
+ except ValidationError as err:
+ raise BadRequest(detail=str(err.messages))
+ if update_mask:
+ patch_body_ = {}
+ if update_mask != ['is_paused']:
+ raise BadRequest(detail="Only `is_paused` field can be updated
through the REST API")
+ update_mask = update_mask[0]
+ patch_body_[update_mask] = patch_body[update_mask]
Review comment:
```suggestion
if update_mask != ['is_paused']:
raise BadRequest(detail="Only `is_paused` field can be updated
through the REST API")
patch_body_[update_mask[0]] = patch_body[update_mask[0]]
```
Pre-emptively fix the Mypy issue that eventually needs to be fixed by the
ongoing Mypy-enabling effort 🙂
--
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]