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
#[MapRequestPayload] attribute, introduced in Symfony 6.3, is an awesome feature for APIs that use JSON for requests. The attribute works with Serializer and Validator components, and returns 422 Unprocessable Entity status code on Validator returned any violation(s). However, in API development, sometimes we want 400 Bad Request instead of 422. So it would be great if we can customise the status code that MapRequestPayload returns on validation error.
Example
Option 1. Use attribute to customise for each endpoint