Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Open Subsurface Data Universe Software
Platform
Domain Data Management Services
Wellbore
Wellbore Domain Services
Commits
e53ed1d1
Commit
e53ed1d1
authored
Aug 31, 2021
by
fabian serin
Browse files
Fix validation error model
parent
2f6f3d63
Pipeline
#61933
failed with stages
in 19 minutes and 32 seconds
Changes
2
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
app/errors/validation_error.py
View file @
e53ed1d1
...
...
@@ -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"
,
...
...
spec/generated/openapi.json
View file @
e53ed1d1
...
...
@@ -3394,7 +3394,14 @@
"properties": {
"loc": {
"items": {
"type": "string"
"oneOf": [
{
"type": "string"
},
{
"type": "integer"
}
]
},
"title": "Location",
"type": "array"
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment