zircote/swagger-php attributes were moved to Attributes namespace

This commit is contained in:
Guilhem Niot 2022-01-10 16:53:40 +01:00
parent 411cb4c27d
commit e0b25e5580
2 changed files with 9 additions and 8 deletions

View File

@ -15,23 +15,23 @@ use Nelmio\ApiDocBundle\Annotation\Areas;
use Nelmio\ApiDocBundle\Annotation\Model;
use Nelmio\ApiDocBundle\Annotation\Security;
use Nelmio\ApiDocBundle\Tests\Functional\Entity\Article;
use OpenApi\Annotations as OA;
use OpenApi\Attributes as OA;
use Symfony\Component\Routing\Annotation\Route;
class ApiController81 extends ApiController80
{
#[OA\Get([
'value' => new OA\Response(
#[OA\Get(responses: [
new OA\Response(
response: '200',
description: 'Success',
properties: [
'value' => new Model(type: Article::class, groups: ['light']),
attachables: [
new Model(type: Article::class, groups: ['light']),
],
),
])]
#[OA\Parameter(ref: '#/components/parameters/test')]
#[Route('/article_attributes/{id}', methods: ['GET'])]
#[OA\Parameter(name: 'Accept-Version', in: 'header', properties: ['value' => new OA\Schema(type: 'string')])]
#[OA\Parameter(name: 'Accept-Version', in: 'header', attachables: [new OA\Schema(type: 'string')])]
public function fetchArticleActionWithAttributes()
{
}

View File

@ -15,6 +15,7 @@ use Doctrine\Common\Annotations\AnnotationReader;
use Nelmio\ApiDocBundle\Model\ModelRegistry;
use Nelmio\ApiDocBundle\ModelDescriber\Annotations\OpenApiAnnotationsReader;
use OpenApi\Annotations as OA;
use OpenApi\Attributes as OAattr;
use OpenApi\Generator;
use PHPUnit\Framework\TestCase;
@ -57,9 +58,9 @@ class AnnotationReaderTest extends TestCase
if (\PHP_VERSION_ID >= 80100) {
yield 'Attributes' => [new class() {
#[OA\Property(example: 1)]
#[OAattr\Property(example: 1)]
private $property1;
#[OA\Property(example: 'some example', description: 'some description')]
#[OAattr\Property(example: 'some example', description: 'some description')]
private $property2;
}];
}