Skip to content

Commit 4f4efc3

Browse files
Add the @ignore annotation support (#3910)
* Revert "Serializer: Support ignore annotation (#3820)" This reverts commit 347a095. * Add the @Ignore annotation support * Try to fix tests * Fix subresources Co-authored-by: soyuka <soyuka@users.noreply.github.com>
1 parent b4f930c commit 4f4efc3

File tree

18 files changed

+421
-209
lines changed

18 files changed

+421
-209
lines changed

behat.yml.dist

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ default:
1111
- 'ApiPlatform\Core\Tests\Behat\HttpCacheContext'
1212
- 'ApiPlatform\Core\Tests\Behat\JsonApiContext'
1313
- 'ApiPlatform\Core\Tests\Behat\JsonHalContext'
14+
- 'ApiPlatform\Core\Tests\Behat\XmlContext'
1415
- 'Behat\MinkExtension\Context\MinkContext'
1516
- 'behatch:context:rest'
1617
filters:
@@ -45,6 +46,7 @@ postgres:
4546
- 'ApiPlatform\Core\Tests\Behat\HttpCacheContext'
4647
- 'ApiPlatform\Core\Tests\Behat\JsonApiContext'
4748
- 'ApiPlatform\Core\Tests\Behat\JsonHalContext'
49+
- 'ApiPlatform\Core\Tests\Behat\XmlContext'
4850
- 'Behat\MinkExtension\Context\MinkContext'
4951
- 'behatch:context:rest'
5052
filters:
@@ -64,6 +66,7 @@ mongodb:
6466
- 'ApiPlatform\Core\Tests\Behat\HttpCacheContext'
6567
- 'ApiPlatform\Core\Tests\Behat\JsonApiContext'
6668
- 'ApiPlatform\Core\Tests\Behat\JsonHalContext'
69+
- 'ApiPlatform\Core\Tests\Behat\XmlContext'
6770
- 'Behat\MinkExtension\Context\MinkContext'
6871
- 'behatch:context:rest'
6972
filters:
@@ -98,6 +101,7 @@ default-coverage:
98101
- 'ApiPlatform\Core\Tests\Behat\JsonApiContext'
99102
- 'ApiPlatform\Core\Tests\Behat\JsonHalContext'
100103
- 'ApiPlatform\Core\Tests\Behat\CoverageContext'
104+
- 'ApiPlatform\Core\Tests\Behat\XmlContext'
101105
- 'Behat\MinkExtension\Context\MinkContext'
102106
- 'behatch:context:rest'
103107

@@ -117,6 +121,7 @@ mongodb-coverage:
117121
- 'ApiPlatform\Core\Tests\Behat\JsonApiContext'
118122
- 'ApiPlatform\Core\Tests\Behat\JsonHalContext'
119123
- 'ApiPlatform\Core\Tests\Behat\CoverageContext'
124+
- 'ApiPlatform\Core\Tests\Behat\XmlContext'
120125
- 'Behat\MinkExtension\Context\MinkContext'
121126
- 'behatch:context:rest'
122127

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"symfony/http-foundation": "^4.4 || ^5.1",
2222
"symfony/http-kernel": "^4.4 || ^5.1",
2323
"symfony/property-access": "^3.4.19 || ^4.4 || ^5.1",
24-
"symfony/property-info": "^3.4 || ^4.4 || ^5.1",
24+
"symfony/property-info": "^3.4 || ^4.4 || ^5.2.1",
2525
"symfony/serializer": "^4.4 || ^5.1",
2626
"symfony/web-link": "^4.4 || ^5.1",
2727
"willdurand/negotiation": "^2.0.3 || ^3.0"

features/doctrine/search_filter.feature

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Feature: Search filter on collections
1919
Given there is a DummyCar entity with related colors
2020
When I send a "GET" request to "/dummy_cars?colors.prop=red"
2121
Then the response status code should be 200
22-
And the JSON should be deep equal to:
22+
And the JSON should be equal to:
2323
"""
2424
{
2525
"@context": "/contexts/DummyCar",
@@ -81,25 +81,25 @@ Feature: Search filter on collections
8181
"hydra:mapping": [
8282
{
8383
"@type": "IriTemplateMapping",
84-
"variable": "availableAt[after]",
84+
"variable": "availableAt[before]",
8585
"property": "availableAt",
8686
"required": false
8787
},
8888
{
8989
"@type": "IriTemplateMapping",
90-
"variable": "availableAt[before]",
90+
"variable": "availableAt[strictly_before]",
9191
"property": "availableAt",
9292
"required": false
9393
},
9494
{
9595
"@type": "IriTemplateMapping",
96-
"variable": "availableAt[strictly_after]",
96+
"variable": "availableAt[after]",
9797
"property": "availableAt",
9898
"required": false
9999
},
100100
{
101101
"@type": "IriTemplateMapping",
102-
"variable": "availableAt[strictly_before]",
102+
"variable": "availableAt[strictly_after]",
103103
"property": "availableAt",
104104
"required": false
105105
},
@@ -111,44 +111,38 @@ Feature: Search filter on collections
111111
},
112112
{
113113
"@type": "IriTemplateMapping",
114-
"variable": "colors",
115-
"property": "colors",
116-
"required": false
117-
},
118-
{
119-
"@type": "IriTemplateMapping",
120-
"variable": "colors.prop",
121-
"property": "colors.prop",
114+
"variable": "foobar[]",
115+
"property": null,
122116
"required": false
123117
},
124118
{
125119
"@type": "IriTemplateMapping",
126-
"variable": "colors[]",
127-
"property": "colors",
120+
"variable": "foobargroups[]",
121+
"property": null,
128122
"required": false
129123
},
130124
{
131125
"@type": "IriTemplateMapping",
132-
"variable": "foobar[]",
126+
"variable": "foobargroups_override[]",
133127
"property": null,
134128
"required": false
135129
},
136130
{
137131
"@type": "IriTemplateMapping",
138-
"variable": "foobargroups[]",
139-
"property": null,
132+
"variable": "colors.prop",
133+
"property": "colors.prop",
140134
"required": false
141135
},
142136
{
143137
"@type": "IriTemplateMapping",
144-
"variable": "foobargroups_override[]",
145-
"property": null,
138+
"variable": "colors",
139+
"property": "colors",
146140
"required": false
147141
},
148142
{
149143
"@type": "IriTemplateMapping",
150-
"variable": "name",
151-
"property": "name",
144+
"variable": "colors[]",
145+
"property": "colors",
152146
"required": false
153147
},
154148
{
@@ -186,6 +180,12 @@ Feature: Search filter on collections
186180
"variable": "uuid[]",
187181
"property": "uuid",
188182
"required": false
183+
},
184+
{
185+
"@type": "IriTemplateMapping",
186+
"variable": "name",
187+
"property": "name",
188+
"required": false
189189
}
190190
]
191191
}
@@ -278,7 +278,6 @@ Feature: Search filter on collections
278278
Then the response status code should be 200
279279
And the response should be in JSON
280280
And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"
281-
And print last JSON response
282281
And the JSON should be valid according to this schema:
283282
"""
284283
{

features/graphql/introspection.feature

Lines changed: 108 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,56 @@ Feature: GraphQL introspection support
7171
And the response should be in JSON
7272
And the header "Content-Type" should be equal to "application/json"
7373
And the JSON node "data.type1.description" should be equal to "Dummy Product."
74-
And the JSON node "data.type1.fields[1].type.name" should be equal to "DummyAggregateOfferConnection"
75-
And the JSON node "data.type2.fields[0].name" should be equal to "edges"
76-
And the JSON node "data.type2.fields[0].type.ofType.name" should be equal to "DummyAggregateOfferEdge"
77-
And the JSON node "data.type3.fields[0].name" should be equal to "node"
78-
And the JSON node "data.type3.fields[1].name" should be equal to "cursor"
79-
And the JSON node "data.type3.fields[0].type.name" should be equal to "DummyAggregateOffer"
74+
And the JSON node "data.type1.fields" should contain:
75+
"""
76+
{
77+
"name":"offers",
78+
"type":{
79+
"name":"DummyAggregateOfferConnection",
80+
"kind":"OBJECT",
81+
"ofType":null
82+
}
83+
}
84+
"""
85+
And the JSON node "data.type2.fields" should contain:
86+
"""
87+
{
88+
"name":"edges",
89+
"type":{
90+
"name":null,
91+
"kind":"LIST",
92+
"ofType":{
93+
"name":"DummyAggregateOfferEdge",
94+
"kind":"OBJECT"
95+
}
96+
}
97+
}
98+
"""
99+
And the JSON node "data.type3.fields" should contain:
100+
"""
101+
{
102+
"name":"node",
103+
"type":{
104+
"name":"DummyAggregateOffer",
105+
"kind":"OBJECT",
106+
"ofType":null
107+
}
108+
}
109+
"""
110+
And the JSON node "data.type3.fields" should contain:
111+
"""
112+
{
113+
"name":"cursor",
114+
"type":{
115+
"name":null,
116+
"kind":"NON_NULL",
117+
"ofType":{
118+
"name":"String",
119+
"kind":"SCALAR"
120+
}
121+
}
122+
}
123+
"""
80124

81125
Scenario: Introspect types with different serialization groups for item_query and collection_query
82126
When I send the following GraphQL request:
@@ -201,7 +245,7 @@ Feature: GraphQL introspection support
201245
Then the response status code should be 200
202246
And the response should be in JSON
203247
And the header "Content-Type" should be equal to "application/json"
204-
And the JSON should be deep equal to:
248+
And the JSON should be equal to:
205249
"""
206250
{
207251
"data": {
@@ -286,8 +330,17 @@ Feature: GraphQL introspection support
286330
Then the response status code should be 200
287331
And the response should be in JSON
288332
And the header "Content-Type" should be equal to "application/json"
289-
And the JSON node "data.__type.fields[9].name" should be equal to "jsonData"
290-
And the JSON node "data.__type.fields[9].type.name" should be equal to "Iterable"
333+
And the JSON node "data.__type.fields" should contain:
334+
"""
335+
{
336+
"name":"jsonData",
337+
"type":{
338+
"name":"Iterable",
339+
"kind":"SCALAR",
340+
"ofType":null
341+
}
342+
}
343+
"""
291344

292345
Scenario: Retrieve entity - using serialization groups - fields
293346
When I send the following GraphQL request:
@@ -420,13 +473,52 @@ Feature: GraphQL introspection support
420473
Then the response status code should be 200
421474
And the response should be in JSON
422475
And the header "Content-Type" should be equal to "application/json"
423-
And the JSON node "data.typeCreatePayload.fields" should have 2 elements
424-
And the JSON node "data.typeCreatePayload.fields[0].name" should be equal to "dummyProperty"
425-
And the JSON node "data.typeCreatePayload.fields[0].type.name" should be equal to "createDummyPropertyPayloadData"
426-
And the JSON node "data.typeCreatePayload.fields[1].name" should be equal to "clientMutationId"
427-
And the JSON node "data.typeCreatePayloadData.fields[3].name" should be equal to "group"
428-
And the JSON node "data.typeCreatePayloadData.fields[3].type.name" should be equal to "createDummyGroupNestedPayload"
429-
And the JSON node "data.typeCreateNestedPayload.fields[0].name" should be equal to "id"
476+
And the JSON node "data.typeCreatePayload.fields" should be equal to:
477+
"""
478+
[
479+
{
480+
"name":"dummyProperty",
481+
"type":{
482+
"name":"createDummyPropertyPayloadData",
483+
"kind":"OBJECT",
484+
"ofType":null
485+
}
486+
},
487+
{
488+
"name":"clientMutationId",
489+
"type":{
490+
"name":"String",
491+
"kind":"SCALAR",
492+
"ofType":null
493+
}
494+
}
495+
]
496+
"""
497+
And the JSON node "data.typeCreatePayloadData.fields" should contain:
498+
"""
499+
{
500+
"name":"group",
501+
"type":{
502+
"name":"createDummyGroupNestedPayload",
503+
"kind":"OBJECT",
504+
"ofType":null
505+
}
506+
}
507+
"""
508+
And the JSON node "data.typeCreateNestedPayload.fields" should contain:
509+
"""
510+
{
511+
"name":"id",
512+
"type":{
513+
"name":null,
514+
"kind":"NON_NULL",
515+
"ofType":{
516+
"name":"ID",
517+
"kind":"SCALAR"
518+
}
519+
}
520+
}
521+
"""
430522

431523
Scenario: Retrieve a type name through a GraphQL query
432524
Given there are 4 dummy objects with relatedDummy

0 commit comments

Comments
 (0)