fix(hydra): use correctly enable_docs#7062
Merged
soyuka merged 1 commit intoapi-platform:4.1from Apr 10, 2025
Merged
Conversation
9a5eac4 to
b7033a4
Compare
soyuka
reviewed
Apr 2, 2025
61e9427 to
dab63f4
Compare
soyuka
reviewed
Apr 9, 2025
soyuka
reviewed
Apr 9, 2025
dab63f4 to
a81f8e4
Compare
soyuka
approved these changes
Apr 9, 2025
a81f8e4 to
5bc4eb0
Compare
soyuka
pushed a commit
to soyuka/core
that referenced
this pull request
Apr 10, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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_docsconfiguration parameter removes theapi_docroute: 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_docsis set tofalse, only thejsonlddocumentation format is registered.enable_docsisfalse,hydra:supportedClassis 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 newhideHydraOperationintroduced in feat(metadata): hide an hydra endpoint #6871.enable_entrypointset tofalse), the entrypoint is not added tohydra:entrypointandhydra:supportedClass.