You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Schema validation errors are not caught by error handlers.
I want my application to have a "standard" JSON error format.
For this i register an error handler to format the error response.
Schema validation errors bypass the error handler and do not allow to format the response.
Expected behaviour
HTTP 500
{ "error": 'My custom error format" }
Actual behaviour
HTTP 400
{
"detail": "1000 is greater than the maximum of 90",
"status": 400,
"title": "Validation error",
"type": "about:blank"
}
This will allow users to intercept the error and format its response.
Also change the schema validation title to "Validation error" so the response is easier to read.
Fixesspec-first#1016
Description
Schema validation errors are not caught by error handlers.
I want my application to have a "standard" JSON error format.
For this i register an error handler to format the error response.
Schema validation errors bypass the error handler and do not allow to format the response.
Expected behaviour
Actual behaviour
Steps to reproduce
application.py:
Cause a openAPI schema error (call an endpoint with invalid JSON).
Additional info:
The culprit seems to be
validate_schema
https://github.com/zalando/connexion/blob/master/connexion/decorators/validation.py#L188 that does not throw an error and just returns the endpoint response.The text was updated successfully, but these errors were encountered: