NelmioApiDocBundle: Incompatibility with DoctrineBundle v2.8
Hi,
When I upgraded the doctrine/doctrine-bundle
from 2.7 to 2.8, the NelmioApiDocBundle stopped to work:
The service "nelmio_api_doc.model_describers.object" has a dependency on a
non-existent service "annotations.reader".
Looks like the doctrine/doctrine-bundle
moved their dependency on doctrine/annotations
from the required
to require-dev
section, starting from version 2.8.0.
Any advice, workaround, or maybe a new version of this great bundle which will work with the recent DoctrineBundle, please? š
P.S. The NelmioApiDocBundle is great, btw. Thanks!
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 5
- Comments: 16 (5 by maintainers)
doctrine/annotations
will be optional soon in swagger-php: https://github.com/zircote/swagger-php/pull/1508@DjordyKoert Oh, I see that there is multiple new releases today - Iāll try to upgrade that bundle and see what happens - thanks!
Iām having the same issue when using NelmioApiDocBundle in prod. Setting
framework.annotations.enabled: true
solves it for now, but itās deprecated since Symfony 6.4:Also, NelmioApiDocBundle is indeed great, thank you for the work!
Thanks for the additional details. I think the root cause is that you use NelmioApiDocBundle as a dev dependency, Symfony core moves more and more to enabling features by default only if they are available in prod (the
willBeAvailable
field in https://github.com/symfony/symfony/blob/c301d9a49a1562b39d8c28eee2b5f4791d51ab14/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php#L971 checks that).An immediate solution for you is to add
framework.annotations: true
to your dev config.Longer term I see either:
packages/dev/nelmio.yaml
enabling the annotationsI prefer just modifying the recipe personally although thatās possibly bothering for people also using NelmioApiDocBundle as a dev dependency and that will have the same issue (because of doctrine-bundle or another dependency) until they upgrade to the new recipeā¦
Thank you ā¤ļø
I donāt really understand the root cause here,
zircote/swagger-php
still has a dependency ondoctrine/annotations
so it should still work fine.Which version of NelmioApiDocBundle are you using? Is it v3.x? Are you activating annotations in your framework bundle config? (i.e.
framework.annotations: true
)If not too sensitive, having your composer.lock (maybe without the private packages if you use any) could help pinpoint the root issue.
Unfortunately thatās a hard dependency as we use the annotations from
zircote/swagger-php
as models. Unless they remove the dependency in their bundle first, it would be a too big investment to remote this dependency here.The latest version solved it for me as well, thank you!
I think upgrading the recipe is a fine solution. Meanwhile, those who use NelmioApiDocBundle as a dev dependency can update
framework.annotations
until new version is released.Thank you for your help!