Skip to content

[Bug]: Regression in 4.x with swagger-php 5.6.x: missing OpenApi\Processors\Concerns\TypesTrait in SymfonyMapQueryParameterDescriber #2591

@marcella-galambos-framna

Description

Version

4.38.2

Description

Summary

Upgrading to zircote/swagger-php 5.6.x breaks nelmio/api-doc-bundle 4.x during container compilation with:

  Class "OpenApi\Processors\Concerns\TypesTrait" not found while loading
  "Nelmio\ApiDocBundle\RouteDescriber\RouteArgumentDescriber\SymfonyMapQueryParameterDescriber"

This appears to be related to swagger-php’s zircote/swagger-php#1829 in 5.6.0, which removed/relocated OpenApi\Processors\Concerns\TypesTrait. Nelmio 4.x still references it, while a 5.x commit (#2588) removes the dependency.

Affected versions

  • nelmio/api-doc-bundle: 4.38.2 (and likely other 4.x releases)
  • zircote/swagger-php: 5.6.0, 5.6.1
  • Symfony: 6.4 (and also observed on 7.x projects)

Steps to reproduce

  1. Fresh project requiring Nelmio 4.x and allowing swagger-php 5.6.x:

    composer.json (minimal):

   {
     "require": {
       "php": ">=8.1",
       "symfony/framework-bundle": "^6.4",
       "nelmio/api-doc-bundle": "^4.15"
     }
   }
  1. Run composer update (will install zircote/swagger-php 5.6.x)
  2. Run bin/console cache:clear (or any command that boots the kernel)

Actual result

Fatal error during container compilation:

PHP Fatal error: During class fetch: Uncaught ReflectionException:
Class "OpenApi\Processors\Concerns\TypesTrait" not found while loading
"Nelmio\ApiDocBundle\RouteDescriber\RouteArgumentDescriber\SymfonyMapQueryParameterDescriber".

Trace excerpt points to:
vendor/nelmio/api-doc-bundle/src/RouteDescriber/RouteArgumentDescriber/SymfonyMapQueryParameterDescriber.php:23

Expected result

Nelmio 4.x compiles and runs with allowed swagger-php versions (including the latest ^5.0).

Workarounds

  • Pin swagger-php to <5.6 in the root project, or add a conflict zircote/swagger-php:>=5.6.

Proposed fixes

Any of the following for the 4.x line would resolve it:

  1. Backport the 5.x change that removes the dependency on TypesTrait (or guard its usage).
  2. If removal is not feasible, restrict the 4.x composer constraint to avoid 5.6.x, e.g.:
    "zircote/swagger-php": "^4.11.1 || ^5.0 <5.6"
  3. Add a conflict against zircote/swagger-php >= 5.6 on the 4.x branch and release a 4.38.x patch.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions