Using the input form the boolean values are sent as string. In Symfony application using boolean type validation / checkbox input form it's recognized as true value. It would be better if normal false & true is sent for boolean values (at least when application/json is used).
Some examples of request:
{
"create_task": {
"name": "Task name",
"date": "2016-06-06",
"important": "0"
}
}
{
"create_task": {
"name": "Task name",
"date": "2016-06-06",
"important": "1"
}
}
I have the same problem
@ApiDoc(
* section = "Basic usage",
* input = "AppBundleFormTypeApiTransactionApiType",
...
in my formType
$builder
->add('tutorial_enabled', null, ['required'=> false, 'property_path' => 'tutorialEnabled', 'description' => 'Tutorial enabled'])
I think "property_path" is not reading
+1 to this. I have no property_path setting, just a basic checkbox field.
$builder->add('myBoolField', 'checkbox');
I have the same problem:
I my class:
/**
* @ApiDoc(
* resource=true,
* description="Crea un 谩rea",
* views = { "default" },
* requirements={
* {
* "name"="descripcion",
* "dataType"="string",
* "requirement"="\[[:alnum:]]+",
* "description"="Descripci贸n de la nueva 脕rea (脷nico)"
* },
* {
* "name"="activa",
* "dataType"="integer",
* "requirement"="\d+",
* "description"="Estado del 谩rea [1|0] Activo|Inactivo"
* }
*
* }
*/
Then in sandbox allways add quotes to my integer param "activa", It's BAD.
When I test with postman or Insomnia rest clients works well.
PLEASE FIX THE SANDBOX !!!
Anyone found a workaround?
@logickphp could you find a solution to integer escaping?
Well guys, boolean is boolean, but number is being sent as string...
indeed it seems like this Bundle should be changed to send boolean values as such when using JSON.
here is a quick hack to make it work ..
https://github.com/nelmio/NelmioApiDocBundle/pull/989
Most helpful comment
I have the same problem:
I my class:
/** * @ApiDoc( * resource=true, * description="Crea un 谩rea", * views = { "default" }, * requirements={ * { * "name"="descripcion", * "dataType"="string", * "requirement"="\[[:alnum:]]+", * "description"="Descripci贸n de la nueva 脕rea (脷nico)" * }, * { * "name"="activa", * "dataType"="integer", * "requirement"="\d+", * "description"="Estado del 谩rea [1|0] Activo|Inactivo" * } * * } */Then in sandbox allways add quotes to my integer param "activa", It's BAD.
When I test with postman or Insomnia rest clients works well.
PLEASE FIX THE SANDBOX !!!