Skip to content

Commit e8c2f86

Browse files
committed
fix: retro-compatibility with bc flag
METADATA_BACKWARD_COMPATIBILITY_LAYER
1 parent 21d1f54 commit e8c2f86

File tree

298 files changed

+7590
-1942
lines changed

Some content is hidden

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

298 files changed

+7590
-1942
lines changed

features/graphql/authorization.feature

+9
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ Feature: Authorization checking
152152
And the JSON node "data.securedDummy.relatedDummy" should exist
153153
And the JSON node "data.securedDummy.relatedDummy" should not be null
154154

155+
@v3
155156
@createSchema
156157
Scenario: A user can't access a secured collection relation
157158
Given there are 1 SecuredDummy objects owned by dunglas with related dummies
@@ -175,6 +176,7 @@ Feature: Authorization checking
175176
And the header "Content-Type" should be equal to "application/json"
176177
And the JSON node "data.securedDummy.relatedDummies" should be null
177178

179+
@v3
178180
Scenario: A user can't access a secured relation
179181
When I add "Authorization" header equal to "Basic ZHVuZ2xhczprZXZpbg=="
180182
And I send the following GraphQL request:
@@ -232,6 +234,7 @@ Feature: Authorization checking
232234
And the JSON node "errors[0].message" should be equal to "Access Denied."
233235
And the JSON node "data.relatedSecuredDummies" should be null
234236

237+
@v3
235238
Scenario: A user can access a secured collection relation
236239
When I add "Authorization" header equal to "Basic ZHVuZ2xhczprZXZpbg=="
237240
And I send the following GraphQL request:
@@ -253,6 +256,7 @@ Feature: Authorization checking
253256
And the header "Content-Type" should be equal to "application/json"
254257
And the JSON node "data.securedDummy.relatedSecuredDummies" should have 1 element
255258

259+
@v3
256260
Scenario: A user can access a secured relation
257261
When I add "Authorization" header equal to "Basic ZHVuZ2xhczprZXZpbg=="
258262
And I send the following GraphQL request:
@@ -271,6 +275,7 @@ Feature: Authorization checking
271275
And the JSON node "data.securedDummy.relatedSecuredDummy" should exist
272276
And the JSON node "data.securedDummy.relatedSecuredDummy" should not be null
273277

278+
@v3
274279
Scenario: A user can access a non-secured collection relation
275280
When I add "Authorization" header equal to "Basic ZHVuZ2xhczprZXZpbg=="
276281
And I send the following GraphQL request:
@@ -292,6 +297,7 @@ Feature: Authorization checking
292297
And the header "Content-Type" should be equal to "application/json"
293298
And the JSON node "data.securedDummy.publicRelatedSecuredDummies" should have 1 element
294299

300+
@v3
295301
Scenario: A user can access a non-secured relation
296302
When I add "Authorization" header equal to "Basic ZHVuZ2xhczprZXZpbg=="
297303
When I send the following GraphQL request:
@@ -382,6 +388,7 @@ Feature: Authorization checking
382388
And the response should be in JSON
383389
And the JSON node "data.securedDummies.edges[2].node.ownerOnlyProperty" should be equal to "it works"
384390

391+
@v3
385392
Scenario: An admin can't create a secured resource with an owner-only property if they won't be the owner
386393
When I add "Authorization" header equal to "Basic YWRtaW46a2l0dGVu"
387394
And I send the following GraphQL request:
@@ -465,6 +472,7 @@ Feature: Authorization checking
465472
And the JSON node "data.securedDummy.adminOnlyProperty" should exist
466473
And the JSON node "data.securedDummy.adminOnlyProperty" should not be null
467474

475+
@v3
468476
Scenario: A user can't see a secured admin-only property on an object they own
469477
When I add "Authorization" header equal to "Basic ZHVuZ2xhczprZXZpbg=="
470478
And I send the following GraphQL request:
@@ -527,6 +535,7 @@ Feature: Authorization checking
527535
And the response should be in JSON
528536
And the JSON node "data.securedDummy.ownerOnlyProperty" should be equal to the string "updated"
529537

538+
@v3
530539
Scenario: An admin can't see a secured owner-only property on an object they don't own
531540
When I add "Authorization" header equal to "Basic YWRtaW46a2l0dGVu"
532541
And I send the following GraphQL request:

features/graphql/mutation.feature

+1
Original file line numberDiff line numberDiff line change
@@ -663,6 +663,7 @@ Feature: GraphQL mutation support
663663
And the JSON node "data.createDummyGroup.clientMutationId" should be equal to "myId"
664664

665665
@createSchema
666+
@v3
666667
Scenario: Use serialization groups with relations
667668
Given there is 1 dummy object with relatedDummy and its thirdLevel
668669
And there is a RelatedDummy with 2 friends

features/json/input_output.feature

+3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Feature: JSON DTO input and output
77
Given I add "Accept" header equal to "application/json"
88
And I add "Content-Type" header equal to "application/json"
99

10+
@createSchema
1011
Scenario: Request a password reset
1112
And I send a "POST" request to "/users/password_reset_request" with body:
1213
"""
@@ -24,6 +25,7 @@ Feature: JSON DTO input and output
2425
}
2526
"""
2627

28+
@createSchema
2729
Scenario: Request a password reset for a non-existent user
2830
And I send a "POST" request to "/users/password_reset_request" with body:
2931
"""
@@ -35,3 +37,4 @@ Feature: JSON DTO input and output
3537
And the response should be in JSON
3638
And the header "Content-Type" should be equal to "application/problem+json; charset=utf-8"
3739
And the JSON node "detail" should be equal to "User does not exist."
40+

features/main/attribute_resource.feature

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Feature: Resource attributes
44
I should be able to fetch data from a state provider
55

66
@php8
7+
@v3
78
@!mysql
89
@!mongodb
910
Scenario: Retrieve a Resource collection
@@ -36,6 +37,7 @@ Feature: Resource attributes
3637
"""
3738

3839
@php8
40+
@v3
3941
@!mysql
4042
@!mongodb
4143
Scenario: Retrieve the first resource
@@ -56,6 +58,7 @@ Feature: Resource attributes
5658
"""
5759

5860
@php8
61+
@v3
5962
@!mysql
6063
@!mongodb
6164
Scenario: Retrieve the aliased resource
@@ -78,6 +81,7 @@ Feature: Resource attributes
7881
"""
7982

8083
@php8
84+
@v3
8185
@!mysql
8286
@!mongodb
8387
Scenario: Patch the aliased resource

features/main/crud.feature

+4
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,7 @@ Feature: Create-Retrieve-Update-Delete
560560
And the response should be empty
561561

562562
@php8
563+
@v3
563564
@createSchema
564565
Scenario: Create a resource ProcessorEntity
565566
When I add "Content-Type" header equal to "application/ld+json"
@@ -586,6 +587,7 @@ Feature: Create-Retrieve-Update-Delete
586587
"""
587588

588589
@php8
590+
@v3
589591
Scenario: Create a resource ProviderEntity
590592
When I add "Content-Type" header equal to "application/ld+json"
591593
And I send a "POST" request to "/provider_entities" with body:
@@ -611,6 +613,7 @@ Feature: Create-Retrieve-Update-Delete
611613
"""
612614

613615
@php8
616+
@v3
614617
Scenario: Get a collection of Provider Entities
615618
When I send a "GET" request to "/provider_entities"
616619
Then the response status code should be 200
@@ -635,6 +638,7 @@ Feature: Create-Retrieve-Update-Delete
635638
"""
636639

637640
@php8
641+
@v3
638642
Scenario: Get a resource ProviderEntity
639643
When I send a "GET" request to "/provider_entities/1"
640644
Then the response status code should be 200

features/main/crud_uri_variables.feature

+9
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ Feature: Uri Variables
22

33
@createSchema
44
@php8
5+
@v3
56
Scenario: Create a resource Company
67
When I add "Content-Type" header equal to "application/ld+json"
78
And I send a "POST" request to "/companies" with body:
@@ -28,6 +29,7 @@ Feature: Uri Variables
2829
"""
2930

3031
@php8
32+
@v3
3133
Scenario: Create a second resource Company
3234
When I add "Content-Type" header equal to "application/ld+json"
3335
And I send a "POST" request to "/companies" with body:
@@ -39,6 +41,7 @@ Feature: Uri Variables
3941
Then the response status code should be 201
4042

4143
@php8
44+
@v3
4245
Scenario: Create first Employee
4346
When I add "Content-Type" header equal to "application/ld+json"
4447
And I send a "POST" request to "/employees" with body:
@@ -66,6 +69,7 @@ Feature: Uri Variables
6669
"""
6770

6871
@php8
72+
@v3
6973
Scenario: Create second Employee
7074
When I add "Content-Type" header equal to "application/ld+json"
7175
And I send a "POST" request to "/employees" with body:
@@ -78,6 +82,7 @@ Feature: Uri Variables
7882
Then the response status code should be 201
7983

8084
@php8
85+
@v3
8186
Scenario: Create third Employee
8287
When I add "Content-Type" header equal to "application/ld+json"
8388
And I send a "POST" request to "/employees" with body:
@@ -90,6 +95,7 @@ Feature: Uri Variables
9095
Then the response status code should be 201
9196

9297
@php8
98+
@v3
9399
Scenario: Retrieve the collection of employees
94100
When I add "Content-Type" header equal to "application/ld+json"
95101
And I send a "GET" request to "/companies/2/employees"
@@ -152,6 +158,7 @@ Feature: Uri Variables
152158
And the JSON node "data.companies.edges[1].node.employees.edges[1].node.name" should be equal to "foo3"
153159

154160
@php8
161+
@v3
155162
Scenario: Retrieve the company of an employee
156163
When I add "Content-Type" header equal to "application/ld+json"
157164
And I send a "GET" request to "/employees/1/company"
@@ -171,6 +178,7 @@ Feature: Uri Variables
171178
"""
172179

173180
@php8
181+
@v3
174182
Scenario: Retrieve an employee
175183
When I add "Content-Type" header equal to "application/ld+json"
176184
And I send a "GET" request to "/companies/1/employees/1"
@@ -190,6 +198,7 @@ Feature: Uri Variables
190198
"""
191199

192200
@php8
201+
@v3
193202
Scenario: Trying to get an employee of wrong company
194203
When I add "Content-Type" header equal to "application/ld+json"
195204
And I send a "GET" request to "/companies/1/employees/2"

features/main/operation_resource.feature

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Feature: Resource operations
44
I should be able to persist data from a processor
55

66
@php8
7+
@v3
78
@createSchema
89
@!mongodb
910
Scenario: Create an operation resource
@@ -19,6 +20,7 @@ Feature: Resource operations
1920
Then the response status code should be 201
2021

2122
@php8
23+
@v3
2224
@!mongodb
2325
Scenario: Patch an operation resource
2426
When I add "Content-Type" header equal to "application/merge-patch+json"
@@ -41,6 +43,7 @@ Feature: Resource operations
4143
"""
4244

4345
@php8
46+
@v3
4447
@!mongodb
4548
Scenario: Update an operation resource
4649
When I add "Content-Type" header equal to "application/ld+json"

features/openapi/docs.feature

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ Feature: Documentation support
1010
And the response should be in JSON
1111
And the header "Content-Type" should be equal to "application/json; charset=utf-8"
1212
# Context
13-
And the JSON node "openapi" should be equal to "3.1.0"
13+
# And the JSON node "openapi" should be equal to "3.1.0"
14+
And the JSON node "openapi" should be equal to "3.0.0"
1415
# Root properties
1516
And the JSON node "info.title" should be equal to "My Dummy API"
1617
And the JSON node "info.description" should contain "This is a test API."

src/Action/EntrypointAction.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
namespace ApiPlatform\Action;
1515

1616
use ApiPlatform\Api\Entrypoint;
17-
use ApiPlatform\Core\Metadata\Resource\Factory\ResourceNameCollectionFactoryInterface;
17+
use ApiPlatform\Metadata\Resource\Factory\ResourceNameCollectionFactoryInterface;
1818

1919
/**
2020
* Generates the API entrypoint.

src/Api/Entrypoint.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
namespace ApiPlatform\Api;
1515

16-
use ApiPlatform\Core\Metadata\Resource\ResourceNameCollection;
16+
use ApiPlatform\Metadata\Resource\ResourceNameCollection;
1717

1818
/**
1919
* The first path you will see in the API.

src/Api/IdentifiersExtractor.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
namespace ApiPlatform\Api;
1515

1616
use ApiPlatform\Core\Identifier\CompositeIdentifierParser;
17+
use ApiPlatform\Core\Metadata\Property\Factory\PropertyMetadataFactoryInterface as LegacyPropertyMetadataFactoryInterface;
1718
use ApiPlatform\Exception\RuntimeException;
1819
use ApiPlatform\Metadata\GraphQl\Operation as GraphQlOperation;
1920
use ApiPlatform\Metadata\Property\Factory\PropertyMetadataFactoryInterface;
@@ -33,10 +34,13 @@ final class IdentifiersExtractor implements IdentifiersExtractorInterface
3334
use ResourceClassInfoTrait;
3435

3536
private $propertyNameCollectionFactory;
37+
/**
38+
* @var LegacyPropertyMetadataFactoryInterface|PropertyMetadataFactoryInterface
39+
*/
3640
private $propertyMetadataFactory;
3741
private $propertyAccessor;
3842

39-
public function __construct(ResourceMetadataCollectionFactoryInterface $resourceMetadataFactory, ResourceClassResolverInterface $resourceClassResolver, PropertyNameCollectionFactoryInterface $propertyNameCollectionFactory, PropertyMetadataFactoryInterface $propertyMetadataFactory, PropertyAccessorInterface $propertyAccessor = null)
43+
public function __construct(ResourceMetadataCollectionFactoryInterface $resourceMetadataFactory, ResourceClassResolverInterface $resourceClassResolver, PropertyNameCollectionFactoryInterface $propertyNameCollectionFactory, $propertyMetadataFactory, PropertyAccessorInterface $propertyAccessor = null)
4044
{
4145
$this->resourceMetadataFactory = $resourceMetadataFactory;
4246
$this->resourceClassResolver = $resourceClassResolver;

src/Api/ResourceClassResolver.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313

1414
namespace ApiPlatform\Api;
1515

16-
use ApiPlatform\Core\Metadata\Resource\Factory\ResourceNameCollectionFactoryInterface;
1716
use ApiPlatform\Exception\InvalidArgumentException;
17+
use ApiPlatform\Metadata\Resource\Factory\ResourceNameCollectionFactoryInterface;
1818
use ApiPlatform\Util\ClassInfoTrait;
1919

2020
/**

src/Api/UriVariablesConverter.php

+6-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
namespace ApiPlatform\Api;
1515

16+
use ApiPlatform\Core\Metadata\Property\Factory\PropertyMetadataFactoryInterface as LegacyPropertyMetadataFactoryInterface;
1617
use ApiPlatform\Exception\InvalidUriVariableException;
1718
use ApiPlatform\Metadata\Link;
1819
use ApiPlatform\Metadata\Property\Factory\PropertyMetadataFactoryInterface;
@@ -26,14 +27,18 @@
2627
*/
2728
final class UriVariablesConverter implements UriVariablesConverterInterface
2829
{
30+
/**
31+
* @var LegacyPropertyMetadataFactoryInterface|PropertyMetadataFactoryInterface
32+
*/
2933
private $propertyMetadataFactory;
3034
private $uriVariableTransformers;
3135
private $resourceMetadataCollectionFactory;
3236

3337
/**
3438
* @param iterable<UriVariableTransformerInterface> $uriVariableTransformers
39+
* @param mixed $propertyMetadataFactory
3540
*/
36-
public function __construct(PropertyMetadataFactoryInterface $propertyMetadataFactory, ResourceMetadataCollectionFactoryInterface $resourceMetadataCollectionFactory, iterable $uriVariableTransformers)
41+
public function __construct($propertyMetadataFactory, ResourceMetadataCollectionFactoryInterface $resourceMetadataCollectionFactory, iterable $uriVariableTransformers)
3742
{
3843
$this->propertyMetadataFactory = $propertyMetadataFactory;
3944
$this->uriVariableTransformers = $uriVariableTransformers;

0 commit comments

Comments
 (0)