feat(symfony): composer dependency JSON+LD/Hydra is now optional#7898
Open
giosh94mhz wants to merge 1 commit intoapi-platform:mainfrom
Open
feat(symfony): composer dependency JSON+LD/Hydra is now optional#7898giosh94mhz wants to merge 1 commit intoapi-platform:mainfrom
giosh94mhz wants to merge 1 commit intoapi-platform:mainfrom
Conversation
Contributor
Author
|
I've checked the failing tests, and are all in the form of: 1) ApiPlatform\Symfony\Tests\Bundle\DependencyInjection\ApiPlatformExtensionTest::testCommonConfiguration
LogicException: JSON+LD support cannot be enabled as the JSON+LD component is not installed. Try running "composer require api-platform/jsonld".
/home/runner/work/core/core/src/Symfony/Bundle/DependencyInjection/ApiPlatformExtension.php:715
/home/runner/work/core/core/src/Symfony/Bundle/DependencyInjection/ApiPlatformExtension.php:185
/home/runner/work/core/core/src/Symfony/Tests/Bundle/DependencyInjection/ApiPlatformExtensionTest.php:179I guess this is "expected" since the CI tests for Symfony install only "api-platform/symfony" (without "api-platform/jsonld", nor "api-platform/hydrasonld"), but the tests are configured with: class ApiPlatformExtensionTest
{
final public const DEFAULT_CONFIG = ['api_platform' => [
// ...
'formats' => [
'json' => ['mime_types' => ['json']],
'jsonld' => ['mime_types' => ['application/ld+json']],
'jsonhal' => ['mime_types' => ['application/hal+json']],
],
// ...
'error_formats' => [
'jsonproblem' => ['application/problem+json'],
'jsonld' => ['application/ld+json'],
],
// ...
]];
// ...
} |
Maxcastel
reviewed
Apr 2, 2026
Comment on lines
16
to
18
| use Composer\InstalledVersions; | ||
|
|
||
| use ApiPlatform\Doctrine\Common\Filter\OrderFilterInterface; |
Contributor
There was a problem hiding this comment.
Extra blank line
Suggested change
| use Composer\InstalledVersions; | |
| use ApiPlatform\Doctrine\Common\Filter\OrderFilterInterface; | |
| use Composer\InstalledVersions; | |
| use ApiPlatform\Doctrine\Common\Filter\OrderFilterInterface; |
Maxcastel
reviewed
Apr 2, 2026
2981552 to
5d7fb4d
Compare
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.
I'm switching to the modular version of api-platform/* packages, mainly to get rid of all Laravel dependencies, and I found that JSON-LD/Hydra is somewhat hard-coded to the Symfony package.
I think this requirement can be lowered or totally removed, since simple JSON format is always available for use.
To avoid BC, I've updated the Configuration class with an heuristics to detect the standard case. There are multiple way to detect that (e.g. class_exists), please let me know it this doesn't not stand with your quality standards.