fix(symfony): do not load docs routes if docs disabled
| Q | A |
|---|---|
| Branch? | 4.2 |
| Tickets | |
| License | MIT |
| Doc PR |
We did not do this on purpose a when using JSON-LD you sematically need to have the docs.jsonld route. You should've a way to disable the openapi docs though no?
You should've a way to disable the openapi docs though no?
I'm sorry, but I don't think it's a good idea.
I also refactored a little, please check.
can you rebase, don't you have a way to disable the open api docs? can you explain a little bit more what you want to disable ?
Rebased.
The main goal is not to have a docs route at all.
@soyuka having the next config
'api_platform' => [
'enable_docs' => false,
'enable_re_doc' => false,
'enable_swagger' => false,
'enable_swagger_ui' => false,
],
docs page showing the next error
{"title":"An error occurred","detail":"A set of server priorities should be given.","status":500,"type":"\/errors\/500","trace":[{"file":"\/var\/www\/vendor\/api-platform\/core\/src\/Metadata\/Util\/ContentNegotiationTrait.php","line":100,"function":"getBest","class":"Negotiation\\AbstractNegotiator","type":"->"},{"file":"\/var\/www\/vendor\/api-platform\/core\/src\/Symfony\/Action\/DocumentationAction.php","line":72,"function":"getRequestFormat","class":"ApiPlatform\\Symfony\\Action\\DocumentationAction","type":"->"}
a proper fix for this would be to inject docs_enabled inside DocumentationAction and return 404 if not jsonld.
Refactored