Skip to content

Commit c8a6005

Browse files
committed
Merge 4.0
2 parents b458b55 + dddb970 commit c8a6005

File tree

16 files changed

+1124
-21
lines changed

16 files changed

+1124
-21
lines changed

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
# Changelog
22

3+
## v4.0.7
4+
5+
### Bug fixes
6+
7+
* [17c916c3a](https://github.com/api-platform/core/commit/17c916c3a1bcc837c9bc842dc48390dbeb043450) fix(symfony): BackedEnumProvider typo fix (#6769)
8+
* [216d9ccaa](https://github.com/api-platform/core/commit/216d9ccaacf7845daaaeab30f3a58bb5567430fe) fix(serializer): fetch type on normalization error when possible (#6761)
9+
* [2f967d934](https://github.com/api-platform/core/commit/2f967d9345004779f409b9ce1b5d0cbba84c7132) fix(doctrine): throw an exception when a filter is not found in a parameter (#6767)
10+
* [6c9b508b0](https://github.com/api-platform/core/commit/6c9b508b030976741a68f84e226502e6c218e896) fix(laravel): remove link header when jsonld is not enabled (#6768)
11+
* [736ca045e](https://github.com/api-platform/core/commit/736ca045e6832f04aaa002ddd7b85c55df4696bb) fix(validator): allow to pass both a ConstraintViolationList and a previous exception (#6762)
12+
* [9ac3661b6](https://github.com/api-platform/core/commit/9ac3661b6a75255832203b87a9ba7994add64061) fix(hydra): store and use hydra context in a local variable (#6765)
13+
14+
### Features
15+
316
## v4.0.6
417

518
### Bug fixes

composer.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@
99
"autoload": {
1010
"psr-4": {
1111
"ApiPlatform\\": "src/"
12-
}
12+
},
13+
"files": [
14+
"src/JsonLd/HydraContext.php"
15+
]
1316
},
1417
"autoload-dev": {
1518
"psr-4": {

features/hydra/docs.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Feature: Documentation support
1313
And the response should be in JSON
1414
And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"
1515
# Context
16-
And the JSON node "@context[0]" should be equal to "http://www.w3.org/ns/hydra/context.jsonld"
16+
And the Hydra context matches the online resource "http://www.w3.org/ns/hydra/context.jsonld"
1717
And the JSON node "@context[1].@vocab" should be equal to "http://example.com/docs.jsonld#"
1818
And the JSON node "@context[1].hydra" should be equal to "http://www.w3.org/ns/hydra/core#"
1919
And the JSON node "@context[1].rdf" should be equal to "http://www.w3.org/1999/02/22-rdf-syntax-ns#"

src/Hydra/Serializer/DocumentationNormalizer.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
3636
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
3737

38+
use const ApiPlatform\JsonLd\HYDRA_CONTEXT;
39+
3840
/**
3941
* Creates a machine readable Hydra API documentation.
4042
*
@@ -573,7 +575,7 @@ private function computeDoc(Documentation $object, array $classes, string $hydra
573575
private function getContext(string $hydraPrefix = ContextBuilder::HYDRA_PREFIX): array
574576
{
575577
return [
576-
ContextBuilderInterface::HYDRA_CONTEXT,
578+
HYDRA_CONTEXT,
577579
[
578580
'@vocab' => $this->urlGenerator->generate('api_doc', ['_format' => self::FORMAT], UrlGeneratorInterface::ABS_URL).'#',
579581
'hydra' => ContextBuilderInterface::HYDRA_NS,

src/Hydra/Tests/Serializer/DocumentationNormalizerTest.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
use Prophecy\PhpUnit\ProphecyTrait;
3838
use Symfony\Component\PropertyInfo\Type;
3939

40+
use const ApiPlatform\JsonLd\HYDRA_CONTEXT;
41+
4042
/**
4143
* @author Amrouche Hamza <hamza.simperfit@gmail.com>
4244
*/
@@ -106,7 +108,7 @@ private function doTestNormalize($resourceMetadataFactory = null): void
106108

107109
$expected = [
108110
'@context' => [
109-
'http://www.w3.org/ns/hydra/context.jsonld',
111+
HYDRA_CONTEXT,
110112
[
111113
'@vocab' => '/doc#',
112114
'hydra' => 'http://www.w3.org/ns/hydra/core#',
@@ -406,7 +408,7 @@ public function testNormalizeInputOutputClass(): void
406408

407409
$expected = [
408410
'@context' => [
409-
'http://www.w3.org/ns/hydra/context.jsonld',
411+
HYDRA_CONTEXT,
410412
[
411413
'@vocab' => '/doc#',
412414
'hydra' => 'http://www.w3.org/ns/hydra/core#',
@@ -766,7 +768,7 @@ public function testNormalizeWithoutPrefix(): void
766768

767769
$expected = [
768770
'@context' => [
769-
'http://www.w3.org/ns/hydra/context.jsonld',
771+
HYDRA_CONTEXT,
770772
[
771773
'@vocab' => '/doc#',
772774
'hydra' => 'http://www.w3.org/ns/hydra/core#',

src/JsonLd/ContextBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ private function getResourceContextWithShortname(string $resourceClass, int $ref
185185
}
186186

187187
if (false === ($this->defaultContext[self::HYDRA_CONTEXT_HAS_PREFIX] ?? true)) {
188-
return [ContextBuilderInterface::HYDRA_CONTEXT, $context];
188+
return [HYDRA_CONTEXT, $context];
189189
}
190190

191191
return $context;

0 commit comments

Comments
 (0)