Weird Behaviour with MapRequestPayload #2691
Unanswered
mikamoush-nv
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi !
I'm working on an app that has apiplatform (currently migrating actually so a lot of my routes are still made with classic Symfony Controllers.
On one of them I tried to use the new MapRequestPayload attribute to hydrate a DTO and validate it. But in case there is a validation error, instead of having a nice "violations" array in my response, i get a weird 0:
Here's the code of my controller:
and DTO:
After a LOONG session of debugging I ended up finding the culprit for it : the apiplatform's ConstraintViolationListNormalizer
I still didn't figure out why it transforms the answers this way. I m haven't found anyone else who has the same problem as me so I guess soemthing's wrong with my app. Maybe the configuration of apiplatform ?
here s mine:
Any help would be welcome... Thanks !
Beta Was this translation helpful? Give feedback.
All reactions