Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Messenger][Serializer] Support ValidationFailedException normalization #51739

Closed
MatTheCat opened this issue Sep 25, 2023 · 0 comments · Fixed by #51779
Closed

[Messenger][Serializer] Support ValidationFailedException normalization #51739

MatTheCat opened this issue Sep 25, 2023 · 0 comments · Fixed by #51779

Comments

@MatTheCat
Copy link
Contributor

MatTheCat commented Sep 25, 2023

Description

The validation middleware throws Symfony\Component\Messenger\Exception\ValidationFailedExceptions. You can map them to a 400 status code, but violations won’t be part of the response because the ProblemNormalizer will only consider Symfony\Component\Validator\Exception\ValidationFailedException.

Would it be possible to handle Symfony\Component\Messenger\Exception\ValidationFailedException the same way, so that a conversion step isn’t needed? Or should the ValidationMiddleware throw Symfony\Component\Validator\Exception\ValidationFailedExceptions?

@fabpot fabpot closed this as completed Sep 30, 2023
fabpot added a commit that referenced this issue Sep 30, 2023
…ut Messenger’s `ValidationFailedException` (MatTheCat)

This PR was merged into the 6.4 branch.

Discussion
----------

[Serializer] Make `ProblemNormalizer` give details about Messenger’s `ValidationFailedException`

| Q             | A
| ------------- | ---
| Branch?       | 6.4
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | Fix #51739
| License       | MIT

This PR fixes #51739 by handling `Symfony\Component\Messenger\Exception\ValidationFailedException` in the `ProblemNormalizer`.

Commits
-------

43240ab [Serializer] Make `ProblemNormalizer` give details about Messenger’s `ValidationFailedException`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants