From 43212d9b7e997fec12552d0d5e9052e86f4009b4 Mon Sep 17 00:00:00 2001
From: Guilhem Niot <guilhem@gniot.fr>
Date: Mon, 10 Jan 2022 16:24:35 +0100
Subject: [PATCH 1/3] Context::getRootContext() was removed

---
 Tests/SwaggerPhp/UtilTest.php | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/Tests/SwaggerPhp/UtilTest.php b/Tests/SwaggerPhp/UtilTest.php
index 9255ffa..c83b938 100644
--- a/Tests/SwaggerPhp/UtilTest.php
+++ b/Tests/SwaggerPhp/UtilTest.php
@@ -58,7 +58,7 @@ class UtilTest extends TestCase
     {
         $context = Util::createContext([], $this->rootContext);
 
-        $this->assertSame($this->rootContext, $context->getRootContext());
+        $this->assertContextIsConnectedToRootContext($context);
     }
 
     public function testCreateContextWithProperties()
@@ -818,7 +818,20 @@ class UtilTest extends TestCase
 
     public function assertIsConnectedToRootContext(OA\AbstractAnnotation $annotation)
     {
-        $this->assertSame($this->rootContext, $annotation->_context->getRootContext());
+        $this->assertContextIsConnectedToRootContext($annotation->_context);
+    }
+
+    public function assertContextIsConnectedToRootContext(Context $context)
+    {
+        $getRootContext = \Closure::bind(function (Context $context) use (&$getRootContext) {
+            if (null !== $context->_parent) {
+                return $getRootContext($context->_parent);
+            }
+
+            return $context;
+        }, null, Context::class);
+
+        $this->assertSame($this->rootContext, $getRootContext($context));
     }
 
     private function getSetupPropertiesWithoutClass(array $setup)

From 411cb4c27d2ee96af778495ec6c0c44fe4505a55 Mon Sep 17 00:00:00 2001
From: Guilhem Niot <guilhem@gniot.fr>
Date: Mon, 10 Jan 2022 16:49:16 +0100
Subject: [PATCH 2/3] Do not use open api version from api-platform

---
 Describer/ApiPlatformDescriber.php | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Describer/ApiPlatformDescriber.php b/Describer/ApiPlatformDescriber.php
index 2b837ad..88f092d 100644
--- a/Describer/ApiPlatformDescriber.php
+++ b/Describer/ApiPlatformDescriber.php
@@ -30,6 +30,9 @@ final class ApiPlatformDescriber extends ExternalDocDescriber
                 [DocumentationNormalizer::SPEC_VERSION => 3]
             );
 
+            // TODO: remove this
+            // Temporary fix: zircote/swagger-php does no longer support 3.0.x with x > 0
+            unset($documentation['openapi']);
             unset($documentation['basePath']);
 
             return $documentation;

From e0b25e55803d54e28ecbb361c13a99348b3edc01 Mon Sep 17 00:00:00 2001
From: Guilhem Niot <guilhem@gniot.fr>
Date: Mon, 10 Jan 2022 16:53:40 +0100
Subject: [PATCH 3/3] zircote/swagger-php attributes were moved to Attributes
 namespace

---
 Tests/Functional/Controller/ApiController81.php      | 12 ++++++------
 .../Annotations/AnnotationReaderTest.php             |  5 +++--
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/Tests/Functional/Controller/ApiController81.php b/Tests/Functional/Controller/ApiController81.php
index d509f29..f1c615a 100644
--- a/Tests/Functional/Controller/ApiController81.php
+++ b/Tests/Functional/Controller/ApiController81.php
@@ -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()
     {
     }
diff --git a/Tests/ModelDescriber/Annotations/AnnotationReaderTest.php b/Tests/ModelDescriber/Annotations/AnnotationReaderTest.php
index 1b94351..88aee9e 100644
--- a/Tests/ModelDescriber/Annotations/AnnotationReaderTest.php
+++ b/Tests/ModelDescriber/Annotations/AnnotationReaderTest.php
@@ -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;
             }];
         }