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
If there's an invalid name or description field in the request, Poem returns a 400 Bad Request error. However, the Response Body does not provide any indication or message about the specific field or reason causing the validation failure.
Would it be feasible to enhance the error feedback mechanism to return a descriptive error message when the validator encounters an issue? This would aid in better understanding the root cause of the error for API consumers.
The text was updated successfully, but these errors were encountered:
{
"detail": [
{
"loc": [
"path",
"item_id"
],
"msg": "value is not a valid integer",
"type": "type_error.integer"
}
]
}
I find this super handy because the response tells you all your validation errors in the request, not just the first one it hit.
It would be good if the bad_request_handler got a vec of validation errors rather than a single error. This would then allow one to produce a similar response.
I'd love to have the ability to list all validation errors in a formalized manner. This is a future I widely use in other frameworks to tell the client exactly why the request is bad. Comes in handy in frontend - to paint invalid form fields red and add hints to them.
Maybe add a validation_errors_handler, similiar to bad_request_handler, that would accept a vec of validation errors and return a #[derive(Object)] struct?
Should I issue a separate feature request for this?
Issue Description:
When sending a request with the structure defined as:
which is used in the endpoint:
If there's an invalid
name
ordescription
field in the request, Poem returns a400 Bad Request
error. However, the Response Body does not provide any indication or message about the specific field or reason causing the validation failure.Would it be feasible to enhance the error feedback mechanism to return a descriptive error message when the validator encounters an issue? This would aid in better understanding the root cause of the error for API consumers.
The text was updated successfully, but these errors were encountered: