Skip to content

Commit f45ebe8

Browse files
authored
Merge pull request #772 from dunglas/id_not_iri
ID should not be an IRI when not using an hypermedia format, don't hide the raw ID property by default
2 parents 5ed1c6e + b98890e commit f45ebe8

18 files changed

+81
-70
lines changed

features/composite.feature

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Feature: Retrieve data with Composite identifiers
2121
{
2222
"@id": "/composite_items/1",
2323
"@type": "CompositeItem",
24+
"id": 1,
2425
"field1": "foobar",
2526
"compositeValues": [
2627
"/composite_relations/compositeItem=1;compositeLabel=1",
@@ -42,6 +43,7 @@ Feature: Retrieve data with Composite identifiers
4243
Then the response status code should be 200
4344
And the response should be in JSON
4445
And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"
46+
And print last JSON response
4547
And the JSON should be equal to:
4648
"""
4749
{
@@ -52,17 +54,23 @@ Feature: Retrieve data with Composite identifiers
5254
{
5355
"@id": "/composite_relations/compositeItem=1;compositeLabel=1",
5456
"@type": "CompositeRelation",
55-
"value": "somefoobardummy"
57+
"value": "somefoobardummy",
58+
"compositeItem": "/composite_items/1",
59+
"compositeLabel": "/composite_labels/1"
5660
},
5761
{
5862
"@id": "/composite_relations/compositeItem=1;compositeLabel=2",
5963
"@type": "CompositeRelation",
60-
"value": "somefoobardummy"
64+
"value": "somefoobardummy",
65+
"compositeItem": "/composite_items/1",
66+
"compositeLabel": "/composite_labels/2"
6167
},
6268
{
6369
"@id": "/composite_relations/compositeItem=1;compositeLabel=3",
6470
"@type": "CompositeRelation",
65-
"value": "somefoobardummy"
71+
"value": "somefoobardummy",
72+
"compositeItem": "/composite_items/1",
73+
"compositeLabel": "/composite_labels/3"
6674
}
6775
],
6876
"hydra:totalItems": 4,
@@ -86,10 +94,12 @@ Feature: Retrieve data with Composite identifiers
8694
And the JSON should be equal to:
8795
"""
8896
{
89-
"@context": "\/contexts\/CompositeRelation",
90-
"@id": "\/composite_relations\/compositeItem=1;compositeLabel=1",
97+
"@context": "/contexts/CompositeRelation",
98+
"@id": "/composite_relations/compositeItem=1;compositeLabel=1",
9199
"@type": "CompositeRelation",
92-
"value": "somefoobardummy"
100+
"value": "somefoobardummy",
101+
"compositeItem": "/composite_items/1",
102+
"compositeLabel": "/composite_labels/1"
93103
}
94104
"""
95105

@@ -102,10 +112,12 @@ Feature: Retrieve data with Composite identifiers
102112
And the JSON should be equal to:
103113
"""
104114
{
105-
"@context": "\/contexts\/CompositeRelation",
106-
"@id": "\/composite_relations\/compositeItem=1;compositeLabel=1",
115+
"@context": "/contexts/CompositeRelation",
116+
"@id": "/composite_relations/compositeItem=1;compositeLabel=1",
107117
"@type": "CompositeRelation",
108-
"value": "somefoobardummy"
118+
"value": "somefoobardummy",
119+
"compositeItem": "/composite_items/1",
120+
"compositeLabel": "/composite_labels/1"
109121
}
110122
"""
111123

features/configurable.feature

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Feature: Configurable resource CRUD
1919
{
2020
"@id": "/fileconfigdummies/1",
2121
"@type": "fileconfigdummy",
22+
"id": 1,
2223
"name": "ConfigDummy"
2324
}
2425
],
@@ -54,6 +55,7 @@ Feature: Configurable resource CRUD
5455
"@context": "\/contexts\/fileconfigdummy",
5556
"@id": "\/fileconfigdummies\/1",
5657
"@type": "fileconfigdummy",
58+
"id": 1,
5759
"name": "ConfigDummy"
5860
}
5961
"""

features/content_negotiation.feature

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Feature: Content Negotiation support
1818
And the response should be equal to
1919
"""
2020
<?xml version="1.0"?>
21-
<response><id>/dummies/1</id><description/><dummy/><dummyBoolean/><dummyDate/><dummyFloat/><dummyPrice/><relatedDummy/><relatedDummies/><jsonData/><name_converted/><name>XML!</name><alias/></response>
21+
<response><description/><dummy/><dummyBoolean/><dummyDate/><dummyFloat/><dummyPrice/><relatedDummy/><relatedDummies/><jsonData/><name_converted/><id>1</id><name>XML!</name><alias/></response>
2222
"""
2323

2424
Scenario: Retrieve a collection in XML
@@ -29,7 +29,7 @@ Feature: Content Negotiation support
2929
And the response should be equal to
3030
"""
3131
<?xml version="1.0"?>
32-
<response><item key="0"><id>/dummies/1</id><description/><dummy/><dummyBoolean/><dummyDate/><dummyFloat/><dummyPrice/><relatedDummy/><relatedDummies/><jsonData/><name_converted/><name>XML!</name><alias/></item></response>
32+
<response><item key="0"><description/><dummy/><dummyBoolean/><dummyDate/><dummyFloat/><dummyPrice/><relatedDummy/><relatedDummies/><jsonData/><name_converted/><id>1</id><name>XML!</name><alias/></item></response>
3333
"""
3434

3535
Scenario: Retrieve a collection in XML using the .xml URL
@@ -39,7 +39,7 @@ Feature: Content Negotiation support
3939
And the response should be equal to
4040
"""
4141
<?xml version="1.0"?>
42-
<response><item key="0"><id>/dummies/1</id><description/><dummy/><dummyBoolean/><dummyDate/><dummyFloat/><dummyPrice/><relatedDummy/><relatedDummies/><jsonData/><name_converted/><name>XML!</name><alias/></item></response>
42+
<response><item key="0"><description/><dummy/><dummyBoolean/><dummyDate/><dummyFloat/><dummyPrice/><relatedDummy/><relatedDummies/><jsonData/><name_converted/><id>1</id><name>XML!</name><alias/></item></response>
4343
"""
4444

4545
Scenario: Retrieve a collection in JSON
@@ -52,7 +52,6 @@ Feature: Content Negotiation support
5252
"""
5353
[
5454
{
55-
"id": "/dummies/1",
5655
"description": null,
5756
"dummy": null,
5857
"dummyBoolean": null,
@@ -63,6 +62,7 @@ Feature: Content Negotiation support
6362
"relatedDummies": [],
6463
"jsonData": [],
6564
"name_converted": null,
65+
"id": 1,
6666
"name": "XML!",
6767
"alias": null
6868
}
@@ -81,7 +81,7 @@ Feature: Content Negotiation support
8181
And the response should be equal to
8282
"""
8383
<?xml version="1.0"?>
84-
<response><id>/dummies/2</id><description/><dummy/><dummyBoolean/><dummyDate/><dummyFloat/><dummyPrice/><relatedDummy/><relatedDummies/><jsonData/><name_converted/><name>Sent in JSON</name><alias/></response>
84+
<response><description/><dummy/><dummyBoolean/><dummyDate/><dummyFloat/><dummyPrice/><relatedDummy/><relatedDummies/><jsonData/><name_converted/><id>2</id><name>Sent in JSON</name><alias/></response>
8585
"""
8686

8787
Scenario: Requesting the same format in the Accept header and in the URL should work

features/crud.feature

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ Feature: Create-Retrieve-Update-Delete
4343
]
4444
},
4545
"name_converted": null,
46+
"id": 1,
4647
"name": "My Dummy",
4748
"alias": null
4849
}
@@ -74,6 +75,7 @@ Feature: Create-Retrieve-Update-Delete
7475
]
7576
},
7677
"name_converted": null,
78+
"id": 1,
7779
"name": "My Dummy",
7880
"alias": null
7981
}
@@ -113,6 +115,7 @@ Feature: Create-Retrieve-Update-Delete
113115
]
114116
},
115117
"name_converted": null,
118+
"id": 1,
116119
"name": "My Dummy",
117120
"alias": null
118121
}
@@ -350,6 +353,7 @@ Feature: Create-Retrieve-Update-Delete
350353
}
351354
],
352355
"name_converted": null,
356+
"id": 1,
353357
"name": "A nice dummy",
354358
"alias": null
355359
}

features/crud_abstract.feature

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Feature: Create-Retrieve-Update-Delete on abstract resource
2323
"@id": "/concrete_dummies/1",
2424
"@type": "ConcreteDummy",
2525
"instance": "Concrete",
26+
"id": 1,
2627
"name": "My Dummy"
2728
}
2829
"""
@@ -39,6 +40,7 @@ Feature: Create-Retrieve-Update-Delete on abstract resource
3940
"@id": "/concrete_dummies/1",
4041
"@type": "ConcreteDummy",
4142
"instance": "Concrete",
43+
"id": 1,
4244
"name": "My Dummy"
4345
}
4446
"""
@@ -95,6 +97,7 @@ Feature: Create-Retrieve-Update-Delete on abstract resource
9597
"@id": "/concrete_dummies/1",
9698
"@type": "ConcreteDummy",
9799
"instance": "Become real",
100+
"id": 1,
98101
"name": "A nice dummy"
99102
}
100103
"""

features/custom_identifier.feature

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Feature: Using custom identifier on resource
2121
"@context": "/contexts/CustomIdentifierDummy",
2222
"@id": "/custom_identifier_dummies/1",
2323
"@type": "CustomIdentifierDummy",
24+
"customId": 1,
2425
"name": "My Dummy"
2526
}
2627
"""
@@ -36,6 +37,7 @@ Feature: Using custom identifier on resource
3637
"@context": "/contexts/CustomIdentifierDummy",
3738
"@id": "/custom_identifier_dummies/1",
3839
"@type": "CustomIdentifierDummy",
40+
"customId": 1,
3941
"name": "My Dummy"
4042
}
4143
"""
@@ -55,6 +57,7 @@ Feature: Using custom identifier on resource
5557
{
5658
"@id": "/custom_identifier_dummies/1",
5759
"@type": "CustomIdentifierDummy",
60+
"customId": 1,
5861
"name": "My Dummy"
5962
}
6063
],
@@ -79,6 +82,7 @@ Feature: Using custom identifier on resource
7982
"@context": "/contexts/CustomIdentifierDummy",
8083
"@id": "/custom_identifier_dummies/1",
8184
"@type": "CustomIdentifierDummy",
85+
"customId": 1,
8286
"name": "My Dummy modified"
8387
}
8488
"""

features/custom_writable_identifier.feature

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Feature: Using custom writable identifier on resource
2222
"@context": "/contexts/CustomWritableIdentifierDummy",
2323
"@id": "/custom_writable_identifier_dummies/my_slug",
2424
"@type": "CustomWritableIdentifierDummy",
25+
"slug": "my_slug",
2526
"name": "My Dummy"
2627
}
2728
"""
@@ -37,6 +38,7 @@ Feature: Using custom writable identifier on resource
3738
"@context": "/contexts/CustomWritableIdentifierDummy",
3839
"@id": "/custom_writable_identifier_dummies/my_slug",
3940
"@type": "CustomWritableIdentifierDummy",
41+
"slug": "my_slug",
4042
"name": "My Dummy"
4143
}
4244
"""
@@ -56,6 +58,7 @@ Feature: Using custom writable identifier on resource
5658
{
5759
"@id": "/custom_writable_identifier_dummies/my_slug",
5860
"@type": "CustomWritableIdentifierDummy",
61+
"slug": "my_slug",
5962
"name": "My Dummy"
6063
}
6164
],
@@ -81,6 +84,7 @@ Feature: Using custom writable identifier on resource
8184
"@context": "/contexts/CustomWritableIdentifierDummy",
8285
"@id": "/custom_writable_identifier_dummies/slug_modified",
8386
"@type": "CustomWritableIdentifierDummy",
87+
"slug": "slug_modified",
8488
"name": "My Dummy modified"
8589
}
8690
"""
@@ -94,7 +98,7 @@ Feature: Using custom writable identifier on resource
9498
And 2 properties are available for hydra class "CustomWritableIdentifierDummy"
9599
And "name" property is readable for hydra class "CustomWritableIdentifierDummy"
96100
And "name" property is writable for hydra class "CustomWritableIdentifierDummy"
97-
And "slug" property is not readable for hydra class "CustomWritableIdentifierDummy"
101+
And "slug" property is readable for hydra class "CustomWritableIdentifierDummy"
98102
And "slug" property is writable for hydra class "CustomWritableIdentifierDummy"
99103

100104
@dropSchema

features/hal.feature

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ Feature: HAL support
7474
"dummyPrice": null,
7575
"jsonData": [],
7676
"name_converted": null,
77+
"id": 1,
7778
"name": "Dummy with relations",
7879
"alias": null
7980
}
@@ -113,6 +114,7 @@ Feature: HAL support
113114
"dummyPrice": null,
114115
"jsonData": [],
115116
"name_converted": null,
117+
"id": 1,
116118
"name": "A nice dummy",
117119
"alias": null
118120
}
@@ -214,6 +216,7 @@ Feature: HAL support
214216
"dummyPrice": null,
215217
"jsonData": [],
216218
"name_converted": null,
219+
"id": 1,
217220
"name": "A nice dummy",
218221
"alias": null
219222
}

features/overridden_operation.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ Feature: Create-Retrieve-Update-Delete with a Overridden Operation context
5454
And the response should be equal to
5555
"""
5656
<?xml version="1.0"?>
57-
<response><id>/overridden_operation_dummies/1</id><name>My Overridden Operation Dummy</name><alias/><description>Gerard</description></response>
57+
<response><name>My Overridden Operation Dummy</name><alias/><description>Gerard</description></response>
5858
"""
5959

6060
Scenario: Get a not found exception

features/relation.feature

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Feature: Relations support
1919
"@context": "/contexts/ThirdLevel",
2020
"@id": "/third_levels/1",
2121
"@type": "ThirdLevel",
22+
"id": 1,
2223
"level": 3,
2324
"test": true
2425
}
@@ -39,6 +40,7 @@ Feature: Relations support
3940
"@context": "/contexts/DummyFriend",
4041
"@id": "/dummy_friends/1",
4142
"@type": "DummyFriend",
43+
"id": 1,
4244
"name": "Zoidberg"
4345
}
4446
"""
@@ -63,6 +65,7 @@ Feature: Relations support
6365
"thirdLevel": "/third_levels/1",
6466
"relatedToDummyFriend": null,
6567
"dummyBoolean": null,
68+
"id": 1,
6669
"symfony": "symfony",
6770
"age": null
6871
}
@@ -150,6 +153,7 @@ Feature: Relations support
150153
],
151154
"jsonData": [],
152155
"name_converted": null,
156+
"id": 1,
153157
"name": "Dummy with relations",
154158
"alias": null
155159
}

0 commit comments

Comments
 (0)