fix(hydra): use correctly enable_docs #7062
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR aims to fix definitively a recurring issue: JSON-LD documentation is mandatory but users don't want to expose their endpoints when the API is private: #1568
The
enable_docs
configuration parameter removes theapi_doc
route: the documentation is not exposed anymore, but the URL is needed in some parts of the API Platform code: JSON-LD context, Hydra links, etc.It regularly causes some bugs.
A relating PR was done in 2018:
#1731
This PR was removing the code adding the Hydra headers when the docs is disabled.
IMO @dunglas's comment was right:
In 2023 another PRs were done but never merged:
#5676
#5862
@dunglas's comments were having the same point:
#5676 (comment)
#5862 (comment)
My proposal:
enable_docs
is set tofalse
, only thejsonld
documentation format is registered.enable_docs
isfalse
,hydra:supportedClass
is not filled: the API resources are not included in the documentation but all the other keys stay (@context
,@vocab
...). To do this, it uses the newhideHydraOperation
introduced in feat(metadata): hide an hydra endpoint #6871.enable_entrypoint
set tofalse
), the entrypoint is not added tohydra:entrypoint
andhydra:supportedClass
.