-
-
Notifications
You must be signed in to change notification settings - Fork 936
Closed
Labels
Description
I'm using 2.0.0-RC1 and have an entity called Ingredient with declaration as so
/**
* Ingredient.
*
* @ORM\Table(name="ingredient")
* @ORM\Entity(repositoryClass="AppBundle\Repository\IngredientRepository")
* @ApiResource(iri="http://schema.org/Ingredient")
*/
class Ingredient
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
}
Swagger definition in apidoc.json says
definitions: {
Ingredient: {
type: "object",
xml: {
name: "response"
},
properties: {
id: {
type: "integer"
},
so it expects it to be an int. But, when accessing the API, ID is set as:
"@id": "/api/ingredients/4",
which makes it a string. This means that using swagger-codegen creates the API client which will cast all ID's to 0, as it's using (in PHP language mode)
// $data = /api/ingredients/4
// $class = int
settype($data, $class);
which reproduces as:
$ php70 -r '$s = "/api/ingredients/4"; settype($s, "int"); var_dump($s);'
int(0)