flask-openapi3 icon indicating copy to clipboard operation
flask-openapi3 copied to clipboard

Feature request: Blueprint level error handling for ValidationError

Open dsdanielko opened this issue 9 months ago • 1 comments

Is there a specific reason why ValidationError can only be changed at the app level using validation_error_callback? https://github.com/luolingchun/flask-openapi3/pull/83

It would be great to be able to change it using @api.errorhandler(ValidationError) at the api level for people who are moving to flask-openapi3 from another framework to keep backwards compatibility.

If it is just a lack of contributors issue I could have a go at it also.

Thanks for the help!

dsdanielko avatar Feb 18 '25 12:02 dsdanielko

Welcome to submit a PR. I have a suggestion, I prefer using parameter passing instead of decorators, for example:

  1. @api.get('/book', validation_error_callback=xxx)
  2. api = APIBlueprint('/book', __name__, validation_error_callback=xxx

luolingchun avatar Feb 22 '25 01:02 luolingchun