Skip to content

Commit 4441966

Browse files
committed
Merge 3.2
2 parents 125f2ce + 5a2600f commit 4441966

32 files changed

+389
-59
lines changed

CHANGELOG.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,21 @@ api_platform:
8181
form: ['multipart/form-data']
8282
```
8383

84+
## v3.2.17
85+
86+
### Bug fixes
87+
88+
* [2819d56c8](https://github.com/api-platform/core/commit/2819d56c80f39a53f2e3d5fd7119566ad96b4075) fix(hydra): hydra:view with absolute iris (#6208)
89+
* [98f4b8fca](https://github.com/api-platform/core/commit/98f4b8fcab39b1d09110cc133206e27782ea4791) fix(metadata): Operations priority sort (#6206)
90+
* [a1309bbf2](https://github.com/api-platform/core/commit/a1309bbf2f678081a82290818a91f0a376b3c94c) fix(serializer): skip symfony validation exception (#6220)
91+
92+
## v3.2.16
93+
94+
### Bug fixes
95+
96+
* [56744dcfa](https://github.com/api-platform/core/commit/56744dcfa07f79ca58926cb199356e849ddb3a93) fix(serializer): fix union types on collection denormalization (#6192)
97+
* [d8e2d0c5e](https://github.com/api-platform/core/commit/d8e2d0c5e9b48c15d60a734086b0102b6ecf95c8) fix(doctrine): doctrine/orm:^3.0 support (#6193)
98+
* [f891f16d5](https://github.com/api-platform/core/commit/f891f16d50b665f25e4699291526161e16ce0fa7) fix(doctrine): isAssociationInverseSide before getMappedBy (#6197)
8499

85100
## v3.2.15
86101

@@ -92,7 +107,6 @@ api_platform:
92107
* [8535f9def](https://github.com/api-platform/core/commit/8535f9def6fbd2baff9cedc79c34103940eb4fca) fix(doctrine): read parent class properties on PUT (#6176)
93108
* [a188c9473](https://github.com/api-platform/core/commit/a188c947396e0400ba6e1aadaa262d2e785fd941) fix(symfony): autoconfigure legacy alias fixes #6177 (#6181)
94109
* [e7b442149](https://github.com/api-platform/core/commit/e7b4421496b58f7c3db414d11dd357a8dc759323) fix(validator): stop considering properties marked with NotBlank(allowNull=true) as required (#6184)
95-
>>>>>>> upstream/3.2
96110

97111
## v3.2.14
98112

features/doctrine/multiple_filter.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Feature: Multiple filters on collections
3838
"hydra:view": {
3939
"type": "object",
4040
"properties": {
41-
"@id": {"pattern": "^/dummies\\?dummyDate%5Bafter%5D=2015-04-28&dummyBoolean=1$"},
41+
"@id": {"pattern": "^/dummies\\?dummyBoolean=1&dummyDate%5Bafter%5D=2015-04-28$"},
4242
"@type": {"pattern": "^hydra:PartialCollectionView$"}
4343
}
4444
}

features/elasticsearch/match_filter.feature

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ Feature: Match filter on collections from Elasticsearch
209209
"hydra:view": {
210210
"type": "object",
211211
"properties": {
212-
"@id": {"pattern": "^/tweets\\?message%5B%5D=Good%20job&message%5B%5D=run&author.firstName=Caroline$"},
212+
"@id": {"pattern": "^/tweets\\?author.firstName=Caroline&message%5B%5D=Good%20job&message%5B%5D=run$"},
213213
"@type": {"pattern": "^hydra:PartialCollectionView$"}
214214
}
215215
}
@@ -422,7 +422,7 @@ Feature: Match filter on collections from Elasticsearch
422422
"hydra:view": {
423423
"type": "object",
424424
"properties": {
425-
"@id": {"pattern": "^/books\\?message%5B%5D=Good%20job&message%5B%5D=run&library.firstName=Caroline$"},
425+
"@id": {"pattern": "^/books\\?library.firstName=Caroline&message%5B%5D=Good%20job&message%5B%5D=run$"},
426426
"@type": {"pattern": "^hydra:PartialCollectionView$"}
427427
}
428428
}

features/hydra/absolute.feature

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
Feature: Collections with absolute IRIs support
2+
In order to retrieve large collections of resources
3+
As a client software developer
4+
I need to retrieve paged collections respecting the Hydra specification and with absolute iris
5+
6+
@createSchema
7+
Scenario: Retrieve third page of collection with absolute iris
8+
Given there are 30 absoluteUrlDummy objects with a related absoluteUrlRelationDummy
9+
When I send a "GET" request to "/absolute_url_dummies?page=3"
10+
Then the response status code should be 200
11+
And the response should be in JSON
12+
And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"
13+
And the JSON node "hydra:view" should be equal to:
14+
"""
15+
{
16+
"@id": "http://example.com/absolute_url_dummies?page=3",
17+
"@type": "hydra:PartialCollectionView",
18+
"hydra:first": "http://example.com/absolute_url_dummies?page=1",
19+
"hydra:last": "http://example.com/absolute_url_dummies?page=10",
20+
"hydra:previous": "http://example.com/absolute_url_dummies?page=2",
21+
"hydra:next": "http://example.com/absolute_url_dummies?page=4"
22+
}
23+
"""

features/hydra/collection.feature

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -576,10 +576,10 @@ Feature: Collections support
576576
"hydra:view": {
577577
"type": "object",
578578
"properties": {
579-
"@id": {"pattern": "^/so_manies\\?order%5Bid%5D=desc&id%5Bgt%5D=10$"},
579+
"@id": {"pattern": "^/so_manies\\?id%5Bgt%5D=10&order%5Bid%5D=desc$"},
580580
"@type": {"pattern": "^hydra:PartialCollectionView$"},
581-
"hydra:previous": {"pattern": "^/so_manies\\?order%5Bid%5D=desc&id%5Bgt%5D=13$"},
582-
"hydra:next": {"pattern": "^/so_manies\\?order%5Bid%5D=desc&id%5Blt%5D=10$"}
581+
"hydra:previous": {"pattern": "^/so_manies\\?id%5Bgt%5D=13&order%5Bid%5D=desc$"},
582+
"hydra:next": {"pattern": "^/so_manies\\?id%5Blt%5D=10&order%5Bid%5D=desc$"}
583583
},
584584
"additionalProperties": false
585585
}

features/hydra/docs.feature

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ Feature: Documentation support
6969
And the value of the node "hydra:property.domain" of the property "name" of the Hydra class "Dummy" is "#Dummy"
7070
And the value of the node "hydra:property.range" of the property "name" of the Hydra class "Dummy" is "xmls:string"
7171
And the value of the node "hydra:property.range" of the property "relatedDummy" of the Hydra class "Dummy" is "https://schema.org/Product"
72+
And the value of the node "hydra:property.owl:maxCardinality" of the property "relatedDummy" of the Hydra class "Dummy" is "1"
7273
And the value of the node "hydra:property.range" of the property "relatedDummies" of the Hydra class "Dummy" is "https://schema.org/Product"
7374
And the value of the node "hydra:title" of the property "name" of the Hydra class "Dummy" is "name"
7475
And the value of the node "hydra:description" of the property "name" of the Hydra class "Dummy" is "The dummy name"
@@ -84,6 +85,6 @@ Feature: Documentation support
8485
And the value of the node "returns" of the operation "DELETE" of the Hydra class "Dummy" is "owl:Nothing"
8586
# Deprecations
8687
And the boolean value of the node "owl:deprecated" of the Hydra class "DeprecatedResource" is true
87-
And the boolean value of the node "owl:deprecated" of the property "deprecatedField" of the Hydra class "DeprecatedResource" is true
88+
And the boolean value of the node "hydra:property.owl:deprecated" of the property "deprecatedField" of the Hydra class "DeprecatedResource" is true
8889
And the boolean value of the node "owl:deprecated" of the property "The collection of DeprecatedResource resources" of the Hydra class "The API entrypoint" is true
8990
And the boolean value of the node "owl:deprecated" of the operation "GET" of the Hydra class "DeprecatedResource" is true

features/issues/5926.feature

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,27 @@ Feature: Issue 5926
1010
Then the response status code should be 200
1111
And the response should be in JSON
1212
And the header "Content-Type" should be equal to "application/json; charset=utf-8"
13+
14+
@!mongodb
15+
Scenario: Create and retrieve a JSON:API WriteResource
16+
When I add "Accept" header equal to "application/vnd.api+json"
17+
And I send a "GET" request to "/test_issue5926s/1"
18+
Then the response status code should be 200
19+
And the response should be in JSON
20+
And the header "Content-Type" should be equal to "application/vnd.api+json; charset=utf-8"
21+
22+
@!mongodb
23+
Scenario: Create and retrieve a LD+JSON WriteResource
24+
When I add "Accept" header equal to "application/ld+json"
25+
And I send a "GET" request to "/test_issue5926s/1"
26+
Then the response status code should be 200
27+
And the response should be in JSON
28+
And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"
29+
30+
@!mongodb
31+
Scenario: Create and retrieve a HAL WriteResource
32+
When I add "Accept" header equal to "application/hal+json"
33+
And I send a "GET" request to "/test_issue5926s/1"
34+
Then the response status code should be 200
35+
And the response should be in JSON
36+
And the header "Content-Type" should be equal to "application/hal+json; charset=utf-8"

src/Doctrine/Odm/Tests/DoctrineMongoDbOdmTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public static function createTestDocumentManager($paths = []): DocumentManager
3434
$config->setHydratorDir(sys_get_temp_dir());
3535
$config->setProxyNamespace('SymfonyTests\Doctrine');
3636
$config->setHydratorNamespace('SymfonyTests\Doctrine');
37-
$config->setMetadataDriverImpl(new AttributeDriver($paths, new AttributeReader()));
37+
$config->setMetadataDriverImpl(new AttributeDriver($paths, class_exists(\Doctrine\Common\Annotations\Reader::class) ? new AttributeReader() : null)); // @phpstan-ignore-line type is only documented as phpdoc
3838
$config->setMetadataCache(new ArrayAdapter());
3939

4040
return DocumentManager::create(null, $config);

src/Hal/Serializer/ItemNormalizer.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,9 @@ public function normalize(mixed $object, ?string $format = null, array $context
6161
return parent::normalize($object, $format, $context);
6262
}
6363

64-
if ($this->resourceClassResolver->isResourceClass($resourceClass)) {
65-
$resourceClass = $this->resourceClassResolver->getResourceClass($object, $context['resource_class'] ?? null);
64+
$previousResourceClass = $context['resource_class'] ?? null;
65+
if ($this->resourceClassResolver->isResourceClass($resourceClass) && (null === $previousResourceClass || $this->resourceClassResolver->isResourceClass($previousResourceClass))) {
66+
$resourceClass = $this->resourceClassResolver->getResourceClass($object, $previousResourceClass);
6667
}
6768

6869
$context = $this->initContext($resourceClass, $context);

src/Hydra/Serializer/DocumentationNormalizer.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,18 @@ private function getProperty(ApiProperty $propertyMetadata, string $propertyName
505505
'domain' => $prefixedShortName,
506506
];
507507

508+
if ($propertyMetadata->getDeprecationReason()) {
509+
$propertyData['owl:deprecated'] = true;
510+
}
511+
512+
if ($this->isSingleRelation($propertyMetadata)) {
513+
$propertyData['owl:maxCardinality'] = 1;
514+
}
515+
516+
if (null !== $range = $this->getRange($propertyMetadata)) {
517+
$propertyData['range'] = $range;
518+
}
519+
508520
$property = [
509521
'@type' => 'hydra:SupportedProperty',
510522
'hydra:property' => $propertyData,
@@ -514,22 +526,10 @@ private function getProperty(ApiProperty $propertyMetadata, string $propertyName
514526
'hydra:writeable' => $propertyMetadata->isWritable() || $propertyMetadata->isInitializable(),
515527
];
516528

517-
if (null !== $range = $this->getRange($propertyMetadata)) {
518-
$property['hydra:property']['range'] = $range;
519-
}
520-
521529
if (null !== $description = $propertyMetadata->getDescription()) {
522530
$property['hydra:description'] = $description;
523531
}
524532

525-
if ($propertyMetadata->getDeprecationReason()) {
526-
$property['owl:deprecated'] = true;
527-
}
528-
529-
if ($this->isSingleRelation($propertyMetadata)) {
530-
$property['owl:maxCardinality'] = true;
531-
}
532-
533533
return $property;
534534
}
535535

0 commit comments

Comments
 (0)