Fix User Warning: Multiple definitions for @OA\\Property()->title (#1630)

* Fix User Warning: Multiple definitions for @OA\\Property()->title

* Add test

* Pass CI..
This commit is contained in:
Mantis Development 2020-05-31 09:30:13 +01:00 committed by GitHub
parent 4027fe8b6c
commit 5e6b894bdc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 32 additions and 1 deletions

View File

@ -50,8 +50,8 @@ class AnnotationsReader
public function updateProperty(\ReflectionProperty $reflectionProperty, OA\Property $property, array $serializationGroups = null): void public function updateProperty(\ReflectionProperty $reflectionProperty, OA\Property $property, array $serializationGroups = null): void
{ {
$this->phpDocReader->updateProperty($reflectionProperty, $property);
$this->openApiAnnotationsReader->updateProperty($reflectionProperty, $property, $serializationGroups); $this->openApiAnnotationsReader->updateProperty($reflectionProperty, $property, $serializationGroups);
$this->phpDocReader->updateProperty($reflectionProperty, $property);
$this->symfonyConstraintAnnotationReader->updateProperty($reflectionProperty, $property); $this->symfonyConstraintAnnotationReader->updateProperty($reflectionProperty, $property);
} }
} }

View File

@ -48,6 +48,8 @@ class JMSUser
private $email; private $email;
/** /**
* User Roles Comment.
*
* @Serializer\Type("array<string>") * @Serializer\Type("array<string>")
* @Serializer\Accessor(getter="getRoles", setter="setRoles") * @Serializer\Accessor(getter="getRoles", setter="setRoles")
* @Serializer\Expose * @Serializer\Expose
@ -56,6 +58,14 @@ class JMSUser
*/ */
private $roles; private $roles;
/**
* User Location.
*
* @Serializer\Type("string")
* @Serializer\Expose
*/
private $location;
/** /**
* @Serializer\Type("string") * @Serializer\Type("string")
*/ */

View File

@ -31,6 +31,8 @@ class User
private $email; private $email;
/** /**
* User Roles Comment.
*
* @var string[] * @var string[]
* *
* @OA\Property( * @OA\Property(
@ -42,6 +44,13 @@ class User
*/ */
private $roles; private $roles;
/**
* User Location.
*
* @OA\Property(type = "string")
*/
private $location;
/** /**
* @var int * @var int
* *
@ -112,6 +121,10 @@ class User
$this->roles = $roles; $this->roles = $roles;
} }
public function setLocation(string $location)
{
}
/** /**
* @param int $friendsNumber * @param int $friendsNumber
*/ */

View File

@ -172,6 +172,10 @@ class FunctionalTest extends WebTestCase
'items' => ['type' => 'string'], 'items' => ['type' => 'string'],
'default' => ['user'], 'default' => ['user'],
], ],
'location' => [
'title' => 'User Location.',
'type' => 'string',
],
'friendsNumber' => [ 'friendsNumber' => [
'type' => 'string', 'type' => 'string',
], ],

View File

@ -103,6 +103,10 @@ class JMSFunctionalTest extends WebTestCase
'default' => ['user'], 'default' => ['user'],
'description' => 'Roles list', 'description' => 'Roles list',
], ],
'location' => [
'type' => 'string',
'title' => 'User Location.',
],
'friendsNumber' => [ 'friendsNumber' => [
'type' => 'string', 'type' => 'string',
'maxLength' => 100, 'maxLength' => 100,