Skip to content

Commit 540d75a

Browse files
committed
Merge 4.1
2 parents a8d0c84 + 2e2debb commit 540d75a

File tree

71 files changed

+1327
-941
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+1327
-941
lines changed

CHANGELOG.md

Lines changed: 65 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,27 @@
11
# Changelog
22

3+
## v4.1.0-alpha.2
4+
5+
### Bug fixes
6+
7+
* [01fd74268](https://github.com/api-platform/core/commit/01fd74268cf0e4a289b31ea74bea7f4e089b8361) fix(laravel): restore accidentally removed BooleanFilter
8+
* [db40a63e7](https://github.com/api-platform/core/commit/db40a63e729fe03be84111dac2b0774fea4ab343) fix(hydra): rdfs:label should not duplicate title (#6748)
9+
* [deb2ed265](https://github.com/api-platform/core/commit/deb2ed265dfee7b8a73fd3b542aef3e29eca3412) fix(laravel): fix use laravel fillable for writable props (#6898)
10+
11+
### Features
12+
13+
* [c97db6bb2](https://github.com/api-platform/core/commit/c97db6bb2f6b2db9a6a17141bdb56bd51e9fc50d) feat: swagger ui persist authorization option (#6877)
14+
15+
### Notes
16+
17+
The [hydra patch](#6748) changes default `hydra:title` and uses the resource `shortname`. Previously the `hydra:title` information was duplicating the `hydra:description`.
18+
The `rdfs:label` got removed from the `hydra:Class` as it was used instead of the `hydra:title`.
19+
On `hydra:property` `rdfs:label` got renamed to `label` as the `rdfs` namespace is available in the context.
20+
The `ApiPlatform\Metadata\ErrorResource` and the `ConstraintViolation` (`ValidationException` class) are now generated directly from your PHP classes, only our `ConstraintViolationList` is hard-written and documents the `ConstraintViolation::violation` property. Therefore, your [own error resources](https://api-platform.com/docs/guides/error-resource/) are also documented. On top of that, we now set the `rdfs:subClassOf` to `hydra:Error`.
21+
`#[ApiProperty(hydra: false)]` allows you to skip a documented `hydra:supportedProperty` on a class.
22+
On write operations, we added the [expectsHeader](https://www.hydra-cg.com/spec/latest/core/#hydra:expectsHeader) field.
23+
24+
325
## v4.1.0-alpha.1
426

527
### Bug fixes
@@ -17,14 +39,35 @@
1739
* [d0a442786](https://github.com/api-platform/core/commit/d0a44278630d201b91cbba0774a09f4eeaac88f7) feat(doctrine): enhance getLinksHandler with method validation and typo suggestions (#6874)
1840
* [f67f6f1ac](https://github.com/api-platform/core/commit/f67f6f1acb6476182c18a3503f2a8bc80ae89a0b) feat(doctrine): doctrine filters like laravel eloquent filters (#6775)
1941

42+
## v4.0.16
43+
44+
### Bug fixes
45+
46+
* [dc4fc84ba](https://github.com/api-platform/core/commit/dc4fc84ba93e22b4f44a37e90a93c6d079c1c620) fix(graphql): securityAfterResolver not called
47+
48+
### Features
49+
50+
## v4.0.15
51+
52+
### Bug fixes
53+
54+
* [36cee399c](https://github.com/api-platform/core/commit/36cee399cfd519355b03d0406921066a22ab474c) fix(state): skip Content-Location header for GET requests (#6901)
55+
* [dba9de197](https://github.com/api-platform/core/commit/dba9de197001e91094e594f0e4dc638007cce7a6) fix(symfony): fix property restrictions for root resource with dynamic validation groups (#6908)
56+
57+
### Features
58+
59+
* [421d97ecf](https://github.com/api-platform/core/commit/421d97ecfdbc7d699a3d017d1e3ae3827a38b216) feat(laravel): add support for backed enum normalizers (#6911)
60+
61+
Also contains [v3.4.15 changes](#v3415).
62+
2063
## v4.0.14
2164

2265
### Bug fixes
2366

2467
* [97cdb6b3f](https://github.com/api-platform/core/commit/97cdb6b3f43471789e096c9dc3a0c3c7b6d4e43c) fix(state): remove ProcessorInterface laravel specific type
2568
* [b12a0d005](https://github.com/api-platform/core/commit/b12a0d005fda58a162b82a3574e6ee877838a55b) fix(graphql): register types for parameter args (#6895)
2669

27-
### Features
70+
Also contains [v3.4.14 changes](#v3414).
2871

2972
## v4.0.13
3073

@@ -36,8 +79,6 @@
3679

3780
Also contains [v3.4.10 changes](#v3410).
3881

39-
### Features
40-
4182
## v4.0.12
4283

4384
### Bug fixes
@@ -49,16 +90,12 @@ Also contains [v3.4.10 changes](#v3410).
4990

5091
Also contains [v3.4.9 changes](#v349).
5192

52-
### Features
53-
5493
## v4.0.11
5594

5695
### Bug fixes
5796

5897
* [af66075fd](https://github.com/api-platform/core/commit/af66075fdd6b83bdebc1c4ca33cc0ab7e1a7f8af) fix(laravel): fix foregin keys (relations) beeing in attributes (#6843)
5998

60-
### Features
61-
6299
* [2d59c6369](https://github.com/api-platform/core/commit/2d59c63699b4602cfe4d62504896c6d4121c1be4) feat(laravel): belongs to many relations (#6818)
63100

64101
Also contains [v3.4.8 changes](#v348).
@@ -73,8 +110,6 @@ Also contains [v3.4.8 changes](#v348).
73110

74111
Also contains [v3.4.7 changes](#v347).
75112

76-
### Features
77-
78113
## v4.0.9
79114

80115
### Bug fixes
@@ -85,16 +120,12 @@ Also contains [v3.4.7 changes](#v347).
85120

86121
Also contains [v3.4.6 changes](#v346).
87122

88-
### Features
89-
90123
## v4.0.8
91124

92125
### Bug fixes
93126

94127
* [dddb97075](https://github.com/api-platform/core/commit/dddb97075af9c6e2517e1881b803c9d31a1913cf) fix(symfony): default formats order (#6780)
95128

96-
### Features
97-
98129
## v4.0.7
99130

100131
### Bug fixes
@@ -106,8 +137,6 @@ Also contains [v3.4.6 changes](#v346).
106137
* [736ca045e](https://github.com/api-platform/core/commit/736ca045e6832f04aaa002ddd7b85c55df4696bb) fix(validator): allow to pass both a ConstraintViolationList and a previous exception (#6762)
107138
* [9ac3661b6](https://github.com/api-platform/core/commit/9ac3661b6a75255832203b87a9ba7994add64061) fix(hydra): store and use hydra context in a local variable (#6765)
108139

109-
### Features
110-
111140
## v4.0.6
112141

113142
### Bug fixes
@@ -118,8 +147,6 @@ Also contains [v3.4.6 changes](#v346).
118147
* [67c5a2a24](https://github.com/api-platform/core/commit/67c5a2a2463bca94f0997b4fab1248a08994465b) fix(laravel): jsonapi error serialization (#6755)
119148
* [ac6f667f3](https://github.com/api-platform/core/commit/ac6f667f301f6c4c399a707faf00567239bd98d8) fix(laravel): collection relations other than HasMany (#6737)
120149

121-
### Features
122-
123150
* [cecd77149](https://github.com/api-platform/core/commit/cecd77149795c1a455ac72bc3ed0606413e69900) feat(laravel): use laravel cache setting (#6751)
124151

125152
## v4.0.5
@@ -129,8 +156,6 @@ Also contains [v3.4.6 changes](#v346).
129156
* [4171d5f9c](https://github.com/api-platform/core/commit/4171d5f9cd41731b857c53a186270ba0626baedf) fix(graphql): register query parameter arguments with filters (#6726)
130157
* [48ab53816](https://github.com/api-platform/core/commit/48ab53816c55e6116aa64ac81f522f4b7b9bb9f6) fix(laravel): make command writes to app instead of src (#6723)
131158

132-
### Features
133-
134159
## v4.0.4
135160

136161
### Bug fixes
@@ -175,7 +200,7 @@ Also contains [v3.4.6 changes](#v346).
175200
* [c47e2996e](https://github.com/api-platform/core/commit/c47e2996e51c587c998fde88903703bd6ac9a43c) fix: default format and standard_put values
176201
* [e327f5f69](https://github.com/api-platform/core/commit/e327f5f69c823c1ed674eefc0eb2551e30fb36bd) fix(symfony): namespace of path segment name generator services (#6642)
177202

178-
Notes:
203+
Notes:
179204

180205
`standard_put=true` is now the default, you can set it to `false` using `extra_properties.defaults`
181206

@@ -274,6 +299,19 @@ Notes:
274299

275300
* [0d5f35683](https://github.com/api-platform/core/commit/0d5f356839eb6aa9f536044abe4affa736553e76) feat(laravel): laravel component (#5882)
276301

302+
## v3.4.16
303+
304+
### Bug fixes
305+
306+
* [dc4fc84ba](https://github.com/api-platform/core/commit/dc4fc84ba93e22b4f44a37e90a93c6d079c1c620) fix(graphql): securityAfterResolver not called
307+
* [9eb5c4e94](https://github.com/api-platform/core/commit/9eb5c4e941d0ebf59bc8ef5777b144db9b4a0899) fix(symfony): suggest `DocumentationAction` as replacement for deprecated `SwaggerUiAction` (#6894)
308+
309+
## v3.4.15
310+
311+
### Bug fixes
312+
313+
* [ab03b5544](https://github.com/api-platform/core/commit/ab03b5544f742b98a39cc23fc157f1be7a2e0c63) fix(openapi): typing issue with `openapiContext` in `#[ApiProperty]` (#6910)
314+
277315
## v3.4.14
278316

279317
### Bug fixes
@@ -533,6 +571,13 @@ You should now install `api-platform/symfony` instead of `api-platform/core`.
533571
* [74986cb55](https://github.com/api-platform/core/commit/74986cb552182dc645bd1fc967faa0954dd59e0a) feat: inflector as service (#6447)
534572
* [b47edb2a4](https://github.com/api-platform/core/commit/b47edb2a499c34e79c167f963e3a626a3e9d040a) feat(serializer): context IRI in HAL or JsonApi format (#6215)
535573

574+
## v3.3.15
575+
576+
### Bug fixes
577+
578+
* [dc4fc84ba](https://github.com/api-platform/core/commit/dc4fc84ba93e22b4f44a37e90a93c6d079c1c620) fix(graphql): securityAfterResolver not called
579+
* [9eb5c4e94](https://github.com/api-platform/core/commit/9eb5c4e941d0ebf59bc8ef5777b144db9b4a0899) fix(symfony): suggest `DocumentationAction` as replacement for deprecated `SwaggerUiAction` (#6894)
580+
536581
## v3.3.14
537582

538583
### Bug fixes

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@
124124
"doctrine/common": "^3.2.2",
125125
"doctrine/dbal": "^4.0",
126126
"doctrine/doctrine-bundle": "^2.11",
127-
"doctrine/mongodb-odm": "^2.6",
127+
"doctrine/mongodb-odm": "^2.10",
128128
"doctrine/mongodb-odm-bundle": "^4.0 || ^5.0",
129129
"doctrine/orm": "^2.17 || ^3.0",
130130
"elasticsearch/elasticsearch": "^8.4",

docs/src/Kernel.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,15 @@ public function executeMigrations(string $direction = Direction::UP): void
164164
$em = $this->getContainer()->get('doctrine.orm.entity_manager');
165165
$loader = new ExistingEntityManager($em);
166166
$dependencyFactory = DependencyFactory::fromEntityManager($confLoader, $loader);
167+
$metadataStorage = $dependencyFactory->getMetadataStorage();
167168

168-
$dependencyFactory->getMetadataStorage()->ensureInitialized();
169-
$executed = $dependencyFactory->getMetadataStorage()->getExecutedMigrations();
169+
try {
170+
$metadataStorage->ensureInitialized();
171+
} catch (\Exception) {
172+
// table exists
173+
}
174+
175+
$executed = $metadataStorage->getExecutedMigrations();
170176

171177
if ($executed->hasMigration(new Version($migrationClass)) && Direction::DOWN !== $direction) {
172178
continue;

features/graphql/query.feature

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -677,3 +677,20 @@ Feature: GraphQL query support
677677
Then the response status code should be 200
678678
And the header "Content-Type" should be equal to "application/json"
679679
And the JSON node "data.getSecurityAfterResolver.name" should be equal to "test"
680+
681+
682+
Scenario: Call security after resolver with 403 error (ensure /2 does not match securityAfterResolver)
683+
When I send the following GraphQL request:
684+
""""
685+
{
686+
getSecurityAfterResolver(id: "/security_after_resolvers/2") {
687+
name
688+
}
689+
}
690+
"""
691+
Then the response status code should be 200
692+
And the response should be in JSON
693+
And the header "Content-Type" should be equal to "application/json"
694+
And the JSON node "errors[0].extensions.status" should be equal to 403
695+
And the JSON node "errors[0].message" should be equal to "Access Denied."
696+
And the JSON node "data.getSecurityAfterResolver.name" should not exist

features/hydra/collection.feature

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ Feature: Collections support
7777
When I send a "GET" request to "/dummies?page=7"
7878
Then the response status code should be 200
7979
And the response should be in JSON
80-
And the header "Content-Location" should be equal to "/dummies.jsonld?page=7"
8180
And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"
8281
And the JSON should be valid according to this schema:
8382
"""

features/hydra/docs.feature

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ Feature: Documentation support
3333
And the JSON node "hydra:description" should contain "Made with love"
3434
And the JSON node "hydra:entrypoint" should be equal to "/"
3535
# Supported classes
36-
And the Hydra class "The API entrypoint" exists
37-
And the Hydra class "A constraint violation" exists
38-
And the Hydra class "A constraint violation list" exists
36+
And the Hydra class "Entrypoint" exists
37+
And the Hydra class "ConstraintViolation" exists
38+
And the Hydra class "ConstraintViolationList" exists
3939
And the Hydra class "CircularReference" exists
4040
And the Hydra class "CustomIdentifierDummy" exists
4141
And the Hydra class "CustomNormalizedDummy" exists
@@ -49,7 +49,6 @@ Feature: Documentation support
4949
# Doc
5050
And the value of the node "@id" of the Hydra class "Dummy" is "#Dummy"
5151
And the value of the node "@type" of the Hydra class "Dummy" is "hydra:Class"
52-
And the value of the node "rdfs:label" of the Hydra class "Dummy" is "Dummy"
5352
And the value of the node "hydra:title" of the Hydra class "Dummy" is "Dummy"
5453
And the value of the node "hydra:description" of the Hydra class "Dummy" is "Dummy."
5554
# Properties
@@ -62,7 +61,7 @@ Feature: Documentation support
6261
And the value of the node "@type" of the property "name" of the Hydra class "Dummy" is "hydra:SupportedProperty"
6362
And the value of the node "hydra:property.@id" of the property "name" of the Hydra class "Dummy" is "https://schema.org/name"
6463
And the value of the node "hydra:property.@type" of the property "name" of the Hydra class "Dummy" is "rdf:Property"
65-
And the value of the node "hydra:property.rdfs:label" of the property "name" of the Hydra class "Dummy" is "name"
64+
And the value of the node "hydra:property.label" of the property "name" of the Hydra class "Dummy" is "name"
6665
And the value of the node "hydra:property.domain" of the property "name" of the Hydra class "Dummy" is "#Dummy"
6766
And the value of the node "hydra:property.range" of the property "name" of the Hydra class "Dummy" is "xmls:string"
6867
And the value of the node "hydra:property.range" of the property "relatedDummy" of the Hydra class "Dummy" is "https://schema.org/Product"
@@ -74,14 +73,16 @@ Feature: Documentation support
7473
And the value of the node "@type" of the operation "GET" of the Hydra class "Dummy" contains "hydra:Operation"
7574
And the value of the node "@type" of the operation "GET" of the Hydra class "Dummy" contains "schema:FindAction"
7675
And the value of the node "hydra:method" of the operation "GET" of the Hydra class "Dummy" is "GET"
77-
And the value of the node "hydra:title" of the operation "GET" of the Hydra class "Dummy" is "Retrieves a Dummy resource."
78-
And the value of the node "rdfs:label" of the operation "GET" of the Hydra class "Dummy" is "Retrieves a Dummy resource."
76+
And the value of the node "hydra:title" of the operation "GET" of the Hydra class "Dummy" is "getDummy"
77+
And the value of the node "hydra:description" of the operation "GET" of the Hydra class "Dummy" is "Retrieves a Dummy resource."
7978
And the value of the node "returns" of the operation "GET" of the Hydra class "Dummy" is "Dummy"
80-
And the value of the node "hydra:title" of the operation "PUT" of the Hydra class "Dummy" is "Replaces the Dummy resource."
81-
And the value of the node "hydra:title" of the operation "DELETE" of the Hydra class "Dummy" is "Deletes the Dummy resource."
79+
And the value of the node "hydra:title" of the operation "PUT" of the Hydra class "Dummy" is "putDummy"
80+
And the value of the node "hydra:description" of the operation "PUT" of the Hydra class "Dummy" is "Replaces the Dummy resource."
81+
And the value of the node "hydra:description" of the operation "DELETE" of the Hydra class "Dummy" is "Deletes the Dummy resource."
82+
And the value of the node "hydra:title" of the operation "DELETE" of the Hydra class "Dummy" is "deleteDummy"
8283
And the value of the node "returns" of the operation "DELETE" of the Hydra class "Dummy" is "owl:Nothing"
8384
# Deprecations
8485
And the boolean value of the node "owl:deprecated" of the Hydra class "DeprecatedResource" is true
8586
And the boolean value of the node "hydra:property.owl:deprecated" of the property "deprecatedField" of the Hydra class "DeprecatedResource" is true
86-
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
87+
And the boolean value of the node "owl:deprecated" of the property "getDeprecatedResourceCollection" of the Hydra class "Entrypoint" is true
8788
And the boolean value of the node "owl:deprecated" of the operation "GET" of the Hydra class "DeprecatedResource" is true

features/hydra/error.feature

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ Feature: Error handling
3737
And the JSON should be equal to:
3838
"""
3939
{
40-
"@context": "/contexts/ConstraintViolationList",
40+
"@context": "/contexts/ConstraintViolation",
4141
"@id": "/validation_errors/c1051bb4-d103-4f74-8988-acbcafc7fdc3",
42-
"@type": "ConstraintViolationList",
42+
"@type": "ConstraintViolation",
4343
"status": 422,
4444
"violations": [
4545
{

features/main/crud.feature

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ Feature: Create-Retrieve-Update-Delete
6060
Then the response status code should be 200
6161
And the response should be in JSON
6262
And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"
63+
And the header "Content-Location" should not exist
6364
And the JSON should be equal to:
6465
"""
6566
{
@@ -100,13 +101,14 @@ Feature: Create-Retrieve-Update-Delete
100101
Scenario: Get a not found exception
101102
When I send a "GET" request to "/dummies/42"
102103
Then the response status code should be 404
104+
And the header "Content-Location" should not exist
103105

104106
Scenario: Get a collection
105107
When I send a "GET" request to "/dummies"
106108
Then the response status code should be 200
107109
And the response should be in JSON
108110
And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"
109-
And the header "Content-Location" should be equal to "/dummies.jsonld"
111+
And the header "Content-Location" should not exist
110112
And the JSON should be equal to:
111113
"""
112114
{
@@ -616,6 +618,7 @@ Feature: Create-Retrieve-Update-Delete
616618
Then the response status code should be 200
617619
And the response should be in JSON
618620
And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"
621+
And the header "Content-Location" should not exist
619622
And the JSON should be equal to:
620623
"""
621624
{
@@ -640,6 +643,7 @@ Feature: Create-Retrieve-Update-Delete
640643
Then the response status code should be 200
641644
And the response should be in JSON
642645
And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"
646+
And the header "Content-Location" should not exist
643647
And the JSON should be equal to:
644648
"""
645649
{
@@ -657,6 +661,7 @@ Feature: Create-Retrieve-Update-Delete
657661
Then the response status code should be 200
658662
And the response should be in JSON
659663
And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"
664+
And the header "Content-Location" should not exist
660665
And the JSON should be equal to:
661666
"""
662667
{
@@ -676,6 +681,7 @@ Feature: Create-Retrieve-Update-Delete
676681
Then the response status code should be 200
677682
And the response should be in JSON
678683
And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"
684+
And the header "Content-Location" should not exist
679685
And the JSON should be equal to:
680686
"""
681687
{
@@ -718,6 +724,7 @@ Feature: Create-Retrieve-Update-Delete
718724
Then the response status code should be 200
719725
And the response should be in JSON
720726
And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"
727+
And the header "Content-Location" should not exist
721728
And the JSON should be equal to:
722729
"""
723730
{
@@ -737,6 +744,7 @@ Feature: Create-Retrieve-Update-Delete
737744
Then the response status code should be 200
738745
And the response should be in JSON
739746
And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"
747+
And the header "Content-Location" should not exist
740748
And the JSON should be equal to:
741749
"""
742750
{

features/main/crud_abstract.feature

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ Feature: Create-Retrieve-Update-Delete on abstract resource
3535
Then the response status code should be 200
3636
And the response should be in JSON
3737
And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"
38+
And the header "Content-Location" should not exist
3839
And the JSON should be equal to:
3940
"""
4041
{
@@ -52,6 +53,7 @@ Feature: Create-Retrieve-Update-Delete on abstract resource
5253
Then the response status code should be 200
5354
And the response should be in JSON
5455
And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"
56+
And the header "Content-Location" should not exist
5557
And the JSON should be valid according to this schema:
5658
"""
5759
{

0 commit comments

Comments
 (0)