ahilashsasidharan commented on code in PR #63994:
URL: https://github.com/apache/airflow/pull/63994#discussion_r3069416046
##########
airflow-core/src/airflow/api_fastapi/core_api/routes/public/variables.py:
##########
@@ -183,11 +197,31 @@ def post_variable(
@variables_router.patch(
- "", dependencies=[Depends(action_logging()),
Depends(requires_access_variable_bulk())]
+ "",
+ responses=create_openapi_http_exception_doc([status.HTTP_400_BAD_REQUEST]),
+ dependencies=[Depends(action_logging()),
Depends(requires_access_variable_bulk())],
)
def bulk_variables(
request: BulkBody[VariableBody],
session: SessionDep,
) -> BulkResponse:
"""Bulk create, update, and delete variables."""
+ if not conf.getboolean("core", "multi_team"):
+ invalid_entities = []
+
+ for action in request.actions:
+ if action.action == BulkAction.CREATE or action.action ==
BulkAction.UPDATE:
+ for entity in action.entities:
+ if isinstance(entity, VariableBody) and entity.team_name
is not None:
+ invalid_entities.append(entity.key)
+
+ if invalid_entities:
+ raise HTTPException(
+ status.HTTP_400_BAD_REQUEST,
+ {
+ "message": MULTI_TEAM_ERROR_MESSAGE,
+ "invalid_variable_keys": invalid_entities,
+ },
+ )
Review Comment:
Switched back to 422-style validation.
--
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]