rawwar commented on code in PR #43508:
URL: https://github.com/apache/airflow/pull/43508#discussion_r1832698922


##########
airflow/api_fastapi/core_api/routes/public/dag_run.py:
##########
@@ -121,22 +124,45 @@ 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"
-            )
-    else:
-        update_mask = ["state"]
-
-    for attr_name in update_mask:
+        update_mask_set = set(update_mask)
+        validation_errors = []
+
+        invalid_fields = update_mask_set - set(ALLOWED_FIELD_MASK)
+        if invalid_fields:
+            validation_errors.append(f"Invalid fields in update mask: {', 
'.join(invalid_fields)}")
+
+        missing_fields = update_mask_set - invalid_fields - 
patch_body.model_fields_set
+        if missing_fields:
+            validation_errors.append(f"Fields not present in request body: {', 
'.join(missing_fields)}")
+
+        if validation_errors:
+            raise HTTPException(400, "; ".join(validation_errors))

Review Comment:
   Updated this to be consistent with other endpoints. Thanks!



-- 
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]

Reply via email to