nelmio/NelmioApiDocBundle

[Bug]: Upgrading v4.29.1 -> v4.29.2 breaks documentation rendering

mvhirsch opened this issue · 4 comments

Version

v4.29.2

Description

I just updated from v4.29.1 to v4.29.2 which breaks my tests (requesting /api/docs). Previous version works totally fine, while I'm now facing this error:

ErrorException:
Warning: Undefined array key 22

  at vendor/nelmio/api-doc-bundle/src/OpenApiPhp/Util.php:246
  at Nelmio\ApiDocBundle\OpenApiPhp\Util::getIndexedCollectionItem()
     (vendor/nelmio/api-doc-bundle/src/OpenApiPhp/Util.php:101)
  at Nelmio\ApiDocBundle\OpenApiPhp\Util::getProperty()
     (vendor/nelmio/api-doc-bundle/src/ModelDescriber/JMSModelDescriber.php:179)
  at Nelmio\ApiDocBundle\ModelDescriber\JMSModelDescriber->describe()
     (vendor/nelmio/api-doc-bundle/src/ModelDescriber/BazingaHateoasModelDescriber.php:46)
  at Nelmio\ApiDocBundle\ModelDescriber\BazingaHateoasModelDescriber->describe()
     (vendor/nelmio/api-doc-bundle/src/Model/ModelRegistry.php:115)
  at Nelmio\ApiDocBundle\Model\ModelRegistry->registerSchemas()
     (vendor/nelmio/api-doc-bundle/src/ApiDocGenerator.php:131)
  at Nelmio\ApiDocBundle\ApiDocGenerator->generate()
     (vendor/nelmio/api-doc-bundle/src/Render/RenderOpenApi.php:85)
  at Nelmio\ApiDocBundle\Render\RenderOpenApi->render()
     (vendor/nelmio/api-doc-bundle/src/Render/RenderOpenApi.php:68)
  at Nelmio\ApiDocBundle\Render\RenderOpenApi->renderFromRequest()
     (vendor/nelmio/api-doc-bundle/src/Controller/SwaggerUiController.php:37)
  at Nelmio\ApiDocBundle\Controller\SwaggerUiController->__invoke()
     (vendor/symfony/http-kernel/HttpKernel.php:181)
  at Symfony\Component\HttpKernel\HttpKernel->handleRaw()
     (vendor/symfony/http-kernel/HttpKernel.php:76)
  at Symfony\Component\HttpKernel\HttpKernel->handle()
     (vendor/symfony/http-kernel/Kernel.php:197)
  at Symfony\Component\HttpKernel\Kernel->handle()
     (vendor/symfony/runtime/Runner/Symfony/HttpKernelRunner.php:35)
  at Symfony\Component\Runtime\Runner\Symfony\HttpKernelRunner->run()
     (vendor/autoload_runtime.php:29)
  at require_once('/path/to/project/vendor/autoload_runtime.php')
     (public/index.php:14)                

JSON OpenApi

JSON OpenApi

I'm unable to dump it, because of above error.

Additional context

My annotations are quite complex and very large, so I'm not sure if it's going to help dumping the whole OpenAPI json spec.

I'm using Symfony 6.4, jms/serializer (and bundle), with willdurand/hateoas-bundle as well as fos/rest-routing-bundle:

symfony composer info | grep jms
jms/metadata                              2.8.0   Class/method/property metadata management in PHP
jms/serializer                            3.30.0  Library for (de-)serializing data of any complexity; supports XML, and JSON.
jms/serializer-bundle                     4.2.0   Allows you to easily serialize, and deserialize data of any complexity
symfony composer info | grep willdurand
willdurand/hateoas                        3.10.0  A PHP library to support implementing representations for HATEOAS REST web services
willdurand/hateoas-bundle                 2.6.0   Integration of Hateoas into Symfony2.
willdurand/jsonp-callback-validator       v2.0.0  JSONP callback validator.
willdurand/negotiation                    3.1.0   Content Negotiation tools for PHP provided as a standalone library.
symfony composer info | grep friendsofsymfony
friendsofsymfony/ckeditor-bundle          2.5.0   Provides a CKEditor integration for your Symfony project.
friendsofsymfony/elastica-bundle          v6.4.0  Elasticsearch PHP integration for your Symfony project using Elastica
friendsofsymfony/http-cache               2.15.3  Tools to manage HTTP caching proxies with PHP
friendsofsymfony/http-cache-bundle        2.17.1  Set path based HTTP cache headers and send invalidation requests to your HTTP cache
friendsofsymfony/jsrouting-bundle         3.5.0   A pretty nice way to expose your Symfony routing to client applications.
friendsofsymfony/rest-bundle              3.7.1   This Bundle provides various tools to rapidly develop RESTful API's with Symfony

I'm confident that some annotations might be broken. How can I debug it? Is there something like "validate schema"?

The easiest way to debug for you would be by manually adding dumps inside your vendor folder (var_dump() or dd()).

Could you try out v4.29.3? :)

Just wanted to start on this one. You fixed it! v4.29.3 is working perfectly fine! Thank you very much!