Use of pydantic custom field validator returns HTTP 500 instead of HTTP 400 #2363
rautob
started this conversation in
Potential Issues
Replies: 1 comment
-
Yes, I believe this would be a regression. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a pydantic model with a custom validator that throws a
ValueError
as described in https://docs.pydantic.dev/latest/errors/errors/#custom-errors.The behavior is different in version 1 and 2 when I try to do an invalid post request.
HTTP 400
with details of the validation failure.HTTP 500
with an internal server error instead.I was expecting a
HTTP 400
. Is this a regression or do I need to do something different?Here is a minimal example for Litestar v2.1.0:
Beta Was this translation helpful? Give feedback.
All reactions