This commit is contained in:
simon-huang-t 2025-12-16 21:09:33 +00:00 committed by GitHub
commit a101b052a3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 3 deletions

View File

@ -418,9 +418,12 @@ def get_openapi_path(
openapi_response["description"] = description openapi_response["description"] = description
http422 = "422" http422 = "422"
all_route_params = get_flat_params(route.dependant) all_route_params = get_flat_params(route.dependant)
if (all_route_params or route.body_field) and not any( if (
status in operation["responses"] (all_route_params or route.body_field) # May raise validation error
for status in [http422, "4XX", "default"] and not any( # Doesn't have a defined validation error response already
status in operation["responses"]
for status in [http422, "4XX", "default"]
)
): ):
operation["responses"][http422] = { operation["responses"][http422] = {
"description": "Validation Error", "description": "Validation Error",