MapRequestPayload causes a weird format of my response when validation error happen #54620
Replies: 4 comments
-
Can you please create a small app reproducing this issue? thanks! |
Beta Was this translation helpful? Give feedback.
-
It looks like a bug, but I failed to see where that "0" comes from |
Beta Was this translation helpful? Give feedback.
-
Hey @yceruto thank you for taking the time. This is my output:
And that is exactly what i want to get on my current app... I dont know where that 0 come from as well |
Beta Was this translation helpful? Give feedback.
-
Hi @yceruto , I found the problem. My app works with api platform. The thing is not all my routes are not made with it, we also have classic Symfony Controllers (for most routes actually), apiplatform covers some entities and we re currently trying to migrate everything (long process since big project already in production). Any idea of how to make it better maybe ? |
Beta Was this translation helpful? Give feedback.
-
Hi guys,
I'm on v.6.3.12 (php 8.1.6)
I'm trying to use MapRequestPayload on my route to validate Credential change. The thing is for some reason when there is a validation error (that I need to handle on my UI) the "violation" array doesnt come out well I have a 0 as a key instead, I dont understand why, I suspected a serialization problem
So the output is like this
So I expect a Violation key with the object with property path etc. but I get this "0"
Here is my controller code:
And DTO:
I really dont get why it's not formated properly, I m kinda out of leads... Any help would be welcome
Beta Was this translation helpful? Give feedback.
All reactions