Open Merinorus opened 1 year ago
I made a "draft" pull request. Let me know if it's unclear, not useful, or not relevant at all. If you accept this, I can improve it by adding tests. I didn't measure the performance impact, maybe I could make a condition for this error generation (for instance, a flag in the config).
Hello,
I'm working with this library and I found the option to raise errors (
FLASK_PYDANTIC_VALIDATION_ERROR_RAISE = True
).I was expecting the same kind of error as in FastAPI/Pydantic combination:
In Pydantic, all errors are in the
errors
array and the location (header, body...) is specified directly in "loc".In Flask-Pydantic, errors are in separate folders according to the location:
The
ValidationError(BaseFlaskPydanticException)
exceptione
is raised and you can look for each group errors according to the location:e.body_params
e.form_params
e.path_params
e.query_params
What I would like is, for instance, to add the
e.errors
category which contains all the errors, formatted as in the Pydantic library used by FastAPI.Thank you!