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
-
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"
}
}
- Run
composer update (will install zircote/swagger-php 5.6.x)
- 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:
- Backport the 5.x change that removes the dependency on
TypesTrait (or guard its usage).
- 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"
- 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
Version
4.38.2
Description
Summary
Upgrading to
zircote/swagger-php5.6.x breaksnelmio/api-doc-bundle4.x during container compilation with: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
Steps to reproduce
Fresh project requiring Nelmio 4.x and allowing swagger-php 5.6.x:
composer.json (minimal):
composer update(will installzircote/swagger-php5.6.x)bin/console cache:clear(or any command that boots the kernel)Actual result
Fatal error during container compilation:
Trace excerpt points to:
vendor/nelmio/api-doc-bundle/src/RouteDescriber/RouteArgumentDescriber/SymfonyMapQueryParameterDescriber.php:23Expected result
Nelmio 4.x compiles and runs with allowed swagger-php versions (including the latest
^5.0).Workarounds
<5.6in the root project, or add a conflictzircote/swagger-php:>=5.6.Proposed fixes
Any of the following for the 4.x line would resolve it:
TypesTrait(or guard its usage)."zircote/swagger-php": "^4.11.1 || ^5.0 <5.6"conflictagainstzircote/swagger-php >= 5.6on the 4.x branch and release a 4.38.x patch.Additional context
No response