Dear guys, by default when swagger is not enabled, the version are set to empty
Therefore the json_schema.xml is not loaded and the api_platform.swagger.versions parameter is not set at all.
The thing is that it will throw in the ContainerBuilder You have requested a non-existent service "api_platform.json_schema.schema_factory".
That because the service is decorated in hydra.xml :
In the same way, the api_platform.action.documentation is requiring the api_platform.swagger.versions parameter (which hasn't been defined) leads to the following error : The service "api_platform.action.documentation" has a dependency on a non-existent parameter "api_platform.swagger.versions". Did you mean this: "api_platform.version
https://github.com/api-platform/core/blob/9799193466b0059fd82254798e9a06f32d8ef2f4/src/Bridge/Symfony/Bundle/Resources/config/api.xml#L245
The on-invalid="null" doesn't seems to have any impact...
Set the versions to the default array [2, 3] even when swagger is not enabled because obviously it is used anyway.
I can do the PR off course but I just wanted to make sure/understand the reason to empty this values in every cases...
Note to reproduce:
enable_swagger: false
enable_swagger_ui: false
Proposed solution:
api_platform.hydra.json_schema.schema_factory service should be ~moved to json_schema.xml~ removed when the api_platform.json_schema.schema_factory service is not available.api_platform.swagger.versions parameter should be set to null when Swagger support is disabled.This is what I tried to do @teohhanhui, still I wanted a failing test case and it's hard to reproduce programatically in the ApiPlatformExtensionTest :|.
We def need this quickfix before 2.5 stable imo.
still I wanted a failing test case and it's hard to reproduce programatically in the ApiPlatformExtensionTest
We already have tests for disabling GraphQL support etc., I think they're not too dissimilar?
Most helpful comment
Note to reproduce: