-
|
Usual {
"detail": [
{
"loc": [
"string"
],
"msg": "string",
"type": "string"
}
]
}customized exception_handler @app.exception_handler(RequestValidationError)
async def validation_exception_handler(request: Request, exc: RequestValidationError):
exc_str = f'{exc}'.replace('\n', ' ').replace(' ', ' ')
content = {'code': 10001, 'data': None, 'message': 'some message ...'}
return JSONResponse(content=content, status_code=422)the aim is {
"code": 10001,
"data": ...,
"message": ""
}how to show like this in openapi schema? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
|
see the additional responses section of the documentation. |
Beta Was this translation helpful? Give feedback.
-
|
thanks, helpful |
Beta Was this translation helpful? Give feedback.
-
|
Thanks for the help here @ycd ! 👏 🙇 Thanks for reporting back and closing the issue @panla 👍
|
Beta Was this translation helpful? Give feedback.
see the additional responses section of the documentation.