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
Symfony + fostrestbundle + jmserializer + SensioFrameworkExtraBundle : the doc
with postman : Post a body { "name": true }
Body must be mapped with MyClass
use JMS\Serializer\Annotation as JMS;
class MyClass {
/**
* @JMS\Type("string")
*/
private $name;
}
My controller :
/*
* @ParamConverter("myClass", converter="fos_rest.request_body")
*/
public function postMyClass(Myclass $myClass)
{
dump($myClass);die();
}
dump() result
MyClass:
{
name: "1"
}
Expected Result
MyClass:
{
name: true
}
'true' should not be converted to string
the serializer have not to convert the boolean in type string
Actual Result
'true' is converted to string "1". (same case for numbers where 123 is converted to "123"
Is there a way to keep type ? (so "name" would set to true then in my controller I get error validation)
The text was updated successfully, but these errors were encountered:
Steps required to reproduce the problem
Expected Result
'true' should not be converted to string
the serializer have not to convert the boolean in type string
Actual Result
'true' is converted to string "1". (same case for numbers where 123 is converted to "123"
Is there a way to keep type ? (so "name" would set to true then in my controller I get error validation)
The text was updated successfully, but these errors were encountered: