Skip to content

Commit 2890c47

Browse files
authored
docs: Schemas used in generic extension endpoints are combined using JSON Subschemas (#1482)
This applies the JSON Schema "$ref" feature to pull the object schemas into the payload schema as subschemas. Doing so allows us to validate the example against the overall schema, which found errors (now fixed).
1 parent 11427c6 commit 2890c47

10 files changed

Lines changed: 50 additions & 482 deletions

File tree

extensions/data-transfer/portability-data-transfer-generic/README.md

Lines changed: 20 additions & 473 deletions
Large diffs are not rendered by default.

extensions/data-transfer/portability-data-transfer-generic/media-schema.json renamed to extensions/data-transfer/portability-data-transfer-generic/album-schema.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"$schema" : "https://json-schema.org/draft/2020-12/schema",
3-
"$id": "https://id.schemas.pub/org/dtinit.org/dtp/media-0.1.0",
3+
"$id": "https://id.schemas.pub/o/dtinit.org/dtp/album-schema",
4+
"title": "Schema for Album metadata in data-transfer-project generic endpoints",
45
"type": "object",
56
"properties": {
67
"description": {

extensions/data-transfer/portability-data-transfer-generic/calendar-schema.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{
22
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"$id": "https://id.schemas.pub/o/dtinit.org/dtp/calendar-schema",
4+
"title": "Schema for Calendar object info in data-transfer-project generic endpoints",
35
"$defs": {
46
"CalendarEventTime": {
57
"type": "object",

extensions/data-transfer/portability-data-transfer-generic/error-schema.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"$id": "https://id.schemas.pub/o/dtinit.org/dtp/error-schema",
4+
"title": "Schema for Album metadata in data-transfer-project generic endpoints",
25
"type": "object",
36
"properties": {
47
"error": {

extensions/data-transfer/portability-data-transfer-generic/file-schema.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{
22
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"$id": "https://id.schemas.pub/o/dtinit.org/dtp/file-schema",
4+
"title": "Schema for file (blob) metadata in data-transfer-project generic endpoints",
35
"type": "object",
46
"properties": {
57
"dateModified": {

extensions/data-transfer/portability-data-transfer-generic/folder-schema.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{
22
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"$id": "https://id.schemas.pub/o/dtinit.org/dtp/folder-schema",
4+
"title": "Schema for folder metadata in data-transfer-project generic endpoints",
35
"type": "object",
46
"properties": {
57
"path": {

extensions/data-transfer/portability-data-transfer-generic/payload-schema.json

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{
22
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"$id": "https://id.schemas.pub/o/dtinit.org/dtp/payload-schema",
4+
"title": "Schema for payload wrapper in data-transfer-project generic endpoints",
35
"type": "object",
46
"properties": {
57
"apiVersion": {
@@ -9,9 +11,14 @@
911
"type": "object",
1012
"description": "The inner payload, which contains data from one of the described data verticals",
1113
"minProperties": 1,
12-
"anyOf": [{
13-
"$ref": "media-schema.json"
14-
}]
14+
"anyOf": [
15+
{ "$ref": "album-schema" },
16+
{ "$ref": "calendar-schema" },
17+
{ "$ref": "file-schema" },
18+
{ "$ref": "folder-schema" },
19+
{ "$ref": "photo-and-video-schema" },
20+
{ "$ref": "social-posts-schema" }
21+
]
1522
},
1623
"schemaSource": {
1724
"type": "string",

extensions/data-transfer/portability-data-transfer-generic/photo-and-video-schema.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{
22
"$schema" : "https://json-schema.org/draft/2020-12/schema",
3+
"$id": "https://id.schemas.pub/o/dtinit.org/dtp/photo-and-video-schema",
4+
"title": "Schema for photo and video metadata in data-transfer-project generic endpoints",
35
"$defs": {
46
"FavoriteInfo": {
57
"type": "object",

extensions/data-transfer/portability-data-transfer-generic/media-payload-example.json renamed to extensions/data-transfer/portability-data-transfer-generic/social-post-payload-example.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,28 @@
33
"schemaSource": ".../SocialPostsSerializer.java",
44
"apiVersion": "0.1.0",
55
"payload": {
6-
"@type": "SocialActivityData",
6+
"@type": "SocialActivity",
77
"metadata": {
88
"@type": "SocialActivityMetadata",
99
"actor": {
1010
"@type": "SocialActivityActor",
1111
"id": "321",
1212
"name": "Steve",
13-
"url": null
13+
"url": "http://example.org/actor/321"
1414
}
1515
},
1616
"activity": {
1717
"@type": "SocialActivityModel",
1818
"id": "456",
19-
"published": 1731604863.845677,
19+
"published": "1731604863.845677",
2020
"type": "NOTE",
2121
"attachments": [
2222
{
2323
"@type": "SocialActivityAttachment",
2424
"type": "IMAGE",
2525
"url": "foo.com",
2626
"name": "Foo",
27-
"content": null
27+
"content": "Example content"
2828
}
2929
],
3030
"location": {
@@ -35,7 +35,7 @@
3535
},
3636
"title": "Hello world!",
3737
"content": "Hi there",
38-
"url": null
38+
"url": "http://example.org/post/foo"
3939
}
4040
}
4141
}

extensions/data-transfer/portability-data-transfer-generic/social-posts-schema.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{
22
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"$id": "https://id.schemas.pub/o/dtinit.org/dtp/social-posts-schema",
4+
"title": "Schema for social post object data in data-transfer-project generic endpoints",
35
"type": "object",
46
"properties": {
57
"activity": {

0 commit comments

Comments
 (0)