Commit e53ed1d1 authored by fabian serin's avatar fabian serin
Browse files

Fix validation error model

parent 2f6f3d63
Pipeline #61933 failed with stages
in 19 minutes and 32 seconds
......@@ -17,7 +17,7 @@ from typing import Union
from fastapi.exceptions import RequestValidationError
from fastapi.encoders import jsonable_encoder
from fastapi.openapi.constants import REF_PREFIX
from fastapi.openapi.utils import validation_error_response_definition
from fastapi.openapi.utils import validation_error_response_definition, validation_error_definition
from pydantic import ValidationError
from starlette.requests import Request
from starlette.responses import JSONResponse
......@@ -37,6 +37,18 @@ async def http422_error_handler(
return JSONResponse(content=jsonable_encoder({"errors": exc.errors()}), status_code=HTTP_422_UNPROCESSABLE_ENTITY)
validation_error_definition["properties"] = {
"loc": {
"title": "Location", "type": "array", "items": {
"oneOf": [
{"type": "string"},
{"type": "integer"}
]
}
},
"msg": {"title": "Message", "type": "string"},
"type": {"title": "Error Type", "type": "string"},
}
validation_error_response_definition["properties"] = {
"errors": {
"title": "Errors",
......
......@@ -3394,8 +3394,15 @@
"properties": {
"loc": {
"items": {
"oneOf": [
{
"type": "string"
},
{
"type": "integer"
}
]
},
"title": "Location",
"type": "array"
},
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment