mirror of https://github.com/tiangolo/fastapi.git
Merge 59173d697c into 272204c0c7
This commit is contained in:
commit
a101b052a3
|
|
@ -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 (
|
||||||
|
(all_route_params or route.body_field) # May raise validation error
|
||||||
|
and not any( # Doesn't have a defined validation error response already
|
||||||
status in operation["responses"]
|
status in operation["responses"]
|
||||||
for status in [http422, "4XX", "default"]
|
for status in [http422, "4XX", "default"]
|
||||||
|
)
|
||||||
):
|
):
|
||||||
operation["responses"][http422] = {
|
operation["responses"][http422] = {
|
||||||
"description": "Validation Error",
|
"description": "Validation Error",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue