bugraoz93 commented on code in PR #43508:
URL: https://github.com/apache/airflow/pull/43508#discussion_r1833437570
##########
airflow/api_fastapi/core_api/routes/public/dag_run.py:
##########
@@ -121,22 +121,28 @@ async def patch_dag_run_state(
raise HTTPException(status.HTTP_404_NOT_FOUND, f"Dag with id {dag_id}
was not found")
if update_mask:
- if update_mask != ["state"]:
- raise HTTPException(
- status.HTTP_400_BAD_REQUEST, "Only `state` field can be
updated through the REST API"
- )
+ data = patch_body.model_dump(include=set(update_mask))
else:
- update_mask = ["state"]
+ data = patch_body.model_dump(exclude_unset=True)
Review Comment:
It looks good! One small nit;
I think we shouldn't use `exclude_unset=True` here. This is the second case
where the value isn't included in the body and should be `None`. This parameter
will always eliminate the `note` field when the field is not in the request. In
this case, we cannot make them `None` in the database.
--
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]