Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Twig necessary for JSON-Output since 4.6 #1874

Closed
CatoTH opened this issue Sep 15, 2021 · 6 comments · Fixed by #1878
Closed

Twig necessary for JSON-Output since 4.6 #1874

CatoTH opened this issue Sep 15, 2021 · 6 comments · Fixed by #1878

Comments

@CatoTH
Copy link

CatoTH commented Sep 15, 2021

Hi,

starting version 4.6, it looks like twig, including symfony//asset is necessary to create the JSON output from the console.
The is the error message that I get (when doing a cache:clear, in this case):

Script cache:clear returned with error code 1
!!
!!   // Clearing the cache for the prod environment with debug
!!   // false
!!
!!
!!  In CheckExceptionOnInvalidReferenceBehaviorPass.php line 86:
!!
!!    The service "nelmio_api_doc.render_docs.html" has a dependency on a non-exi
!!    stent service "twig".
!!
!!
!!  cache:clear [--no-warmup] [--no-optional-warmers]
!!
!!
Script @auto-scripts was called via post-update-cmd

It does work again if I restrict the version to 4.5.

@rwatt-futurenet
Copy link

You can fix this by making the service only load the JSON renderer by adding this to services.yaml;

    nelmio_api_doc.render_docs:
        class: Nelmio\ApiDocBundle\Render\RenderOpenApi
        arguments:
            - "@nelmio_api_doc.generator_locator"
            - "@nelmio_api_doc.render_docs.json"

The first argument should always be generator_locator, the rest are the renderers you want to make available - the built in ones are nelmio_api_doc.render_docs.html, nelmio_api_doc.render_docs.json and nelmio_api_doc.render_docs.yaml. Only the html renderer needs twig.

@Th3Mouk
Copy link

Th3Mouk commented Sep 17, 2021

This regression has been introduced by #1842, a way to fix it can be probably to register all new render services on the same tag and use a service subscriber/locator.
Or if it's not possible when twig is not installed, then add a new pass compiler to register right services on runtime.
I don't have enough time to fix it myself today, don't hesitate to try it on your side and link the PR to this issue.

@GuilhemN
Copy link
Collaborator

Hi, thank you for the report!
Could you check whether #1878 does indeed fix your issue please?

@Goazil
Copy link
Contributor

Goazil commented Sep 21, 2021

Hi, thank you for the report!
Could you check whether #1878 does indeed fix your issue please?

Hi @GuilhemN, I had the same issue.

With your PR it seems that the problem is no longer present.

@GuilhemN GuilhemN linked a pull request Sep 22, 2021 that will close this issue
@CatoTH
Copy link
Author

CatoTH commented Sep 27, 2021

@GuilhemN Thank you!

morawskim added a commit to stasiu20/ssorder that referenced this issue Oct 10, 2021
…piDocBundle to version 4.6

More info:
[The service "nelmio_api_doc.render_docs.html.asset" has a dependency on a non-existent service "twig.extension.assets"](nelmio/NelmioApiDocBundle#1876)

[Twig necessary for JSON-Output since 4.6](nelmio/NelmioApiDocBundle#1874)
@BonBonSlick
Copy link

BonBonSlick commented Oct 26, 2021

@rwatt-futurenet There is no extension able to load the configuration for "nelmio_api_doc.render_docs"
or

** The service "nelmio_api_doc.render_docs" has a dependency on a non-existent service "@nelmio_api_doc.generator_locator". Did you mean one of these: "nelmio_api_doc.generator.default", "nelmio_api_doc.generator"?
**

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants