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

Make twig dependency lazy #4187

Merged
merged 1 commit into from Apr 2, 2021

Conversation

mtarld
Copy link
Contributor

@mtarld mtarld commented Apr 2, 2021

Q A
Branch? 2.6
Bug fix? yes
New feature? no
Deprecations? no
Tickets Fix #1149
License MIT

twig is only a part of require-dev. But api_platform.swagger.action.ui and api_platform.swagger_ui.action are requiring it when swagger doc is enabled. As a result, theses services are requiring an unexisting service.

Here is a tiny reproducer:

$ composer create-project symfony/skeleton:^4.4 # Same goes for 5.x versions
$ cd skeleton
$ composer req api-platform/core:2.6 
[...]
Script cache:clear returned with error code 1
!!  
!!  In CheckExceptionOnInvalidReferenceBehaviorPass.php line 86:
!!                                                                                 
!!    The service "api_platform.swagger.action.ui" has a dependency on a non-exis  
!!    tent service "twig". 

This fix approach is to make twig dependency lazy and throwing an exception asking the user to require twig bundle when calling swagger controllers.

@mtarld mtarld force-pushed the fix/twig-dependency-lazyness branch from 2894404 to 5c02a10 Compare April 2, 2021 14:19
@alanpoulain alanpoulain merged commit 49dbfe1 into api-platform:2.6 Apr 2, 2021
@alanpoulain
Copy link
Member

Thank you @mtarld.

@mtarld mtarld deleted the fix/twig-dependency-lazyness branch April 2, 2021 17:29
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 this pull request may close these issues.

None yet

3 participants