Closed romkazor closed 3 years ago
Currently is not possible to custom the error status code. And IMHO if a pydantic validation failed 400 is more appropriate. If you really want always return a 422 instead of 400, you can monkey patch aiohttp_pydantic.view.inject_params. I will provide a way to trigger a pydantic validation error and return a custom response.
Done in version 1.10.0 See documentation https://github.com/Maillol/aiohttp-pydantic/#custom-validation-error for details
When pydantic validation failed (post request), automatic 400 raise instead 422. How can we include 422 default sheme validation in oas or other user schemas?!