Skip to content

Commit 2ffdcda

Browse files
author
GlennGeelen
committed
Update the test data to represent the JSON API v1 object structure
1 parent d391d58 commit 2ffdcda

11 files changed

Lines changed: 263 additions & 152 deletions

JSONAPI.Tests/Data/AttributeSerializationTest.json

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
{
2-
"data": [
3-
{
4-
"type": "samples",
5-
"id": "1",
2+
"data": [
3+
{
4+
"type": "samples",
5+
"id": "1",
6+
"attributes": {
67
"booleanField": false,
78
"nullableBooleanField": false,
89
"sByteField": 0,
@@ -36,9 +37,12 @@
3637
"stringField": null,
3738
"enumField": 0,
3839
"nullableEnumField": null
39-
}, {
40-
"type": "samples",
41-
"id": "2",
40+
}
41+
},
42+
{
43+
"type": "samples",
44+
"id": "2",
45+
"attributes": {
4246
"booleanField": true,
4347
"nullableBooleanField": true,
4448
"sByteField": 123,
@@ -72,6 +76,7 @@
7276
"stringField": "Some string 156",
7377
"enumField": 1,
7478
"nullableEnumField": 2
75-
}
76-
]
79+
}
80+
}
81+
]
7782
}
Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,25 @@
11
{
2-
"data": [
3-
{
4-
"type": "tags",
5-
"id": "1",
6-
"text": "Ember"
7-
}, {
8-
"type": "tags",
9-
"id": "2",
10-
"text": "React"
11-
}, {
12-
"type": "tags",
13-
"id": "3",
14-
"text": "Angular"
15-
}
16-
]
2+
"data": [
3+
{
4+
"type": "tags",
5+
"id": "1",
6+
"attributes": {
7+
"text": "Ember"
8+
}
9+
},
10+
{
11+
"type": "tags",
12+
"id": "2",
13+
"atributes": {
14+
"text": "React"
15+
}
16+
},
17+
{
18+
"type": "tags",
19+
"id": "3",
20+
"attributes": {
21+
"text": "Angular"
22+
}
23+
}
24+
]
1725
}

JSONAPI.Tests/Data/DeserializeAttributeRequest.json

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
{
2-
"data": [
3-
{
4-
"id": "1",
2+
"data": [
3+
{
4+
"id": "1",
5+
"attributes": {
56
"booleanField": false,
6-
"nullableBooleanField": false,
7+
"nullableBooleanField": false,
78
"sByteField": 0,
89
"nullableSByteField": null,
910
"byteField": 0,
@@ -35,8 +36,11 @@
3536
"stringField": null,
3637
"enumField": 0,
3738
"nullableEnumField": null
38-
}, {
39-
"id": "2",
39+
}
40+
},
41+
{
42+
"id": "2",
43+
"attributes": {
4044
"booleanField": true,
4145
"nullableBooleanField": true,
4246
"sByteField": 123,
@@ -70,6 +74,7 @@
7074
"stringField": "Some string 156",
7175
"enumField": 1,
7276
"nullableEnumField": 2
73-
}
74-
]
75-
}
77+
}
78+
}
79+
]
80+
}

JSONAPI.Tests/Data/DeserializeCollectionRequest.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,24 @@
33
{
44
"id": "1",
55
"title": "Linkbait!",
6-
"links": {
6+
"relationships": {
77
"author": {
8-
"linkage": {
8+
"data": {
99
"type": "authors",
1010
"id": "1"
1111
}
1212
},
1313
"comments": {
14-
"linkage": [{ "type": "comments", "id": "400" }, { "type": "comments", "id": "401" }]
14+
"data": [{ "type": "comments", "id": "400" }, { "type": "comments", "id": "401" }]
1515
}
1616
}
1717
},
1818
{
1919
"id": "2",
2020
"title": "Rant #1023",
21-
"links": {
21+
"relationships": {
2222
"author": {
23-
"linkage": {
23+
"data": {
2424
"type": "authors",
2525
"id": "1"
2626
}
Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
{
2-
"data": {
3-
"type": "posts",
4-
"id": "2",
5-
"title": "How to fry an egg",
6-
"links": {
7-
"author": {
8-
"related": "/users/5"
2+
"data": {
3+
"type": "posts",
4+
"id": "2",
5+
"title": "How to fry an egg",
6+
"relationships": {
7+
"author": {
8+
"links": {
9+
"related": "/users/5"
910
}
10-
}
11-
}
11+
}
12+
}
13+
}
1214
}
Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
{
2-
"data": [
3-
{
4-
"type": "comments",
5-
"id": "5",
6-
"body": null,
7-
"customData": { },
8-
"links": {
9-
"post": null
10-
}
11-
}
12-
]
2+
"data": [
3+
{
4+
"type": "comments",
5+
"id": "5",
6+
"attributes": {
7+
"body": null
8+
},
9+
"customData": { },
10+
"relationships": {
11+
"post": null
12+
}
13+
}
14+
]
1315
}

JSONAPI.Tests/Data/MetadataManagerPropertyWasPresentRequest.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
"data": {
33
"type": "posts",
44
"id": "42",
5-
"links": {
5+
"relationships": {
66
"author": {
7-
"linkage": {
7+
"data": {
88
"id": "18",
99
"type": "authors"
1010
}
Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
{
2-
"data": [
3-
{
4-
"type": "non-standard-id-things",
5-
"id": "0657fd6d-a4ab-43c4-84e5-0933c84b4f4f",
6-
"data": "Swap"
7-
}
8-
]
2+
"data": [
3+
{
4+
"type": "non-standard-id-things",
5+
"id": "0657fd6d-a4ab-43c4-84e5-0933c84b4f4f",
6+
"attributes": {
7+
"data": "Swap"
8+
}
9+
}
10+
]
911
}

JSONAPI.Tests/Data/ReformatsRawJsonStringWithUnquotedKeys.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"customData": {
88
"unquotedKey": 5
99
},
10-
"links": {
10+
"relationships": {
1111
"post": null
1212
}
1313
}

0 commit comments

Comments
 (0)