core icon indicating copy to clipboard operation
core copied to clipboard

fix(symfony): do not load docs routes if docs disabled

Open alexndlm opened this issue 4 months ago • 7 comments

Q A
Branch? 4.2
Tickets
License MIT
Doc PR

alexndlm avatar Oct 08 '25 12:10 alexndlm

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?

soyuka avatar Oct 09 '25 08:10 soyuka

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.

alexndlm avatar Oct 09 '25 08:10 alexndlm

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 ?

soyuka avatar Oct 31 '25 09:10 soyuka

Rebased.

The main goal is not to have a docs route at all.

alexndlm avatar Oct 31 '25 09:10 alexndlm

@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":"->"}

ERuban avatar Dec 04 '25 16:12 ERuban

a proper fix for this would be to inject docs_enabled inside DocumentationAction and return 404 if not jsonld.

soyuka avatar Dec 05 '25 15:12 soyuka

Refactored

alexndlm avatar Dec 10 '25 09:12 alexndlm