Christian Schiffler 8da1ac0296 Pass real property to swagger annotation reader
The type invariation (changing from the real property to the sub items
definition) causes the swagger annotations to end up on the created
`Items` entry.
This changes the behaviour to update the real property entry with the
swagger annotation.

Additionally this ensures that "description", "title" and "example" are
only updated on `Schema` instances.
2017-12-15 17:39:18 +01:00

93 lines
1.8 KiB
PHP

<?php
/*
* This file is part of the NelmioApiDocBundle package.
*
* (c) Nelmio
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Nelmio\ApiDocBundle\Tests\Functional\Entity;
use JMS\Serializer\Annotation as Serializer;
use Swagger\Annotations as SWG;
/**
* User.
*
* @Serializer\ExclusionPolicy("all")
*/
class JMSUser
{
/**
* @Serializer\Type("integer")
* @Serializer\Expose
*
* @SWG\Property(description = "User id", required = true, readOnly = true, title = "userid", example=1)
*/
private $id;
/**
* @Serializer\Type("string")
* @Serializer\Expose
*
* @SWG\Property(readOnly = false)
*/
private $email;
/**
* @Serializer\Type("array<string>")
* @Serializer\Accessor(getter="getRoles", setter="setRoles")
* @Serializer\Expose
* @SWG\Property(description = "User roles", required = true, title = "roles", example="[""ADMIN"",""SUPERUSER""]")
*/
private $roles;
/**
* @Serializer\Type("string")
*/
private $password;
/**
* Ignored as the JMS serializer can't detect its type.
*
* @Serializer\Expose
*/
private $createdAt;
/**
* @Serializer\Type("array<Nelmio\ApiDocBundle\Tests\Functional\Entity\User>")
* @Serializer\Expose
*/
private $friends;
/**
* @Serializer\Type("integer")
* @Serializer\Expose
* @Serializer\SerializedName("friendsNumber")
*
* @SWG\Property(type = "string")
*/
private $friendsNumber;
/**
* @Serializer\Type(User::class)
* @Serializer\Expose
*/
private $bestFriend;
public function setRoles($roles)
{
}
public function getRoles()
{
}
public function setDummy(Dummy $dummy)
{
}
}