From: Sebastián Ramírez Date: Mon, 10 Dec 2018 20:28:47 +0000 (+0400) Subject: :bug: Add ValidationError schema even if only bodies X-Git-Tag: 0.1.11~47 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8c66b3a492bb70fab3e045fdb1ab6da40ecca7bf;p=thirdparty%2Ffastapi%2Ffastapi.git :bug: Add ValidationError schema even if only bodies are declared in the defined endpoints --- diff --git a/fastapi/openapi/utils.py b/fastapi/openapi/utils.py index 3e445d6150..6f490a5d0c 100644 --- a/fastapi/openapi/utils.py +++ b/fastapi/openapi/utils.py @@ -172,6 +172,11 @@ def get_openapi_path( ) if request_body_oai: operation["requestBody"] = request_body_oai + if "ValidationError" not in definitions: + definitions["ValidationError"] = validation_error_definition + definitions[ + "HTTPValidationError" + ] = validation_error_response_definition status_code = str(route.status_code) response_schema = {"type": "string"} if lenient_issubclass(route.content_type, JSONResponse):