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
{"code":400,"message":"Validation Failed","errors":{"children":{"firstName":{"errors":["Your first name
must not be empty."]},"lastName":{},"email":{}}}}
Where I was expecting firstName and lastName to come through as first_name and last_name.
All the rest of the serialization works fine (ie, returning objects, converting form posts etc). Just this.
I posted this here as the file that seems to be creating the response is JMS/Serializer/Handler/FormErrorHandler.php and I can't see if/where it is applying any naming strategy to the field names. (ie, line 145; $children[$child->getName()])
The text was updated successfully, but these errors were encountered:
Sorry for the terribly long feedback loop. Probably you have already solved your issue, but just to answer you, the FormErrorHandler does not follow the naming strategies, since is a custom handler for symfony forms
When I return my form errors like:
The errors are returned like:
Where I was expecting
firstName
andlastName
to come through asfirst_name
andlast_name
.All the rest of the serialization works fine (ie, returning objects, converting form posts etc). Just this.
My config (I'm using the FOSRestBundle):
Apologies if this is a configuration problem.
I posted this here as the file that seems to be creating the response is
JMS/Serializer/Handler/FormErrorHandler.php
and I can't see if/where it is applying any naming strategy to the field names. (ie, line 145;$children[$child->getName()]
)The text was updated successfully, but these errors were encountered: