-
-
Notifications
You must be signed in to change notification settings - Fork 896
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(hydra): store and use hydra context in a local variable #6765
fix(hydra): store and use hydra context in a local variable #6765
Conversation
valentin-dassonville
commented
Oct 30, 2024
Q | A |
---|---|
Branch | 4.0 |
License | MIT |
97db06a
to
0454297
Compare
@soyuka it seems to work on api-platform/demo#472 |
Can't we merge the Hydra context in the context we generate? So we avoid an extra HTTP request. |
0a4dedf
to
92009ff
Compare
92009ff
to
36e4d08
Compare
features/hydra/docs.feature
Outdated
And the JSON node "@context[0]" should be equal to: | ||
""" | ||
{ | ||
"@context": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest doing something dynamic like:
- Download the original context from Hydra's website
- Assert that the context we generate is in sync with the upstream one
This will have the benefit of not bloating the tests and making the CI red if upstream changes the context.
WDYT?
@@ -53,4 +52,905 @@ public function getResourceContext(string $resourceClass, int $referenceType = U | |||
* Gets the URI of the given resource context. | |||
*/ | |||
public function getResourceContextUri(string $resourceClass, int $referenceType = UrlGeneratorInterface::ABS_PATH): string; | |||
|
|||
public const HYDRA_CONTEXT = [ | |||
'@context' => [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe could we store this in an external PHP file that we automatically generate from the upstream JSON (so we can regenerate the file if needed).
ade6748
to
d24d2ce
Compare
d24d2ce
to
a7e14dc
Compare
Co-authored-by: Kévin Dunglas <kevin@dunglas.fr>
Thanks @valentin-dassonville ! |