@tryghost/admin-api-schema 2.17.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/README.md +2 -3
  2. package/lib/admin-api-schema.js +12 -92
  3. package/lib/{canary → schemas}/README.md +1 -1
  4. package/lib/{v3 → schemas}/images-upload.json +2 -2
  5. package/lib/{v2 → schemas}/images.json +1 -1
  6. package/lib/{canary → schemas}/index.js +0 -0
  7. package/lib/{v3 → schemas}/labels-add.json +2 -2
  8. package/lib/{v3 → schemas}/labels-edit.json +2 -2
  9. package/lib/{v3 → schemas}/labels.json +1 -1
  10. package/lib/{canary → schemas}/media-upload.json +2 -2
  11. package/lib/{canary → schemas}/media.json +1 -1
  12. package/lib/{v3 → schemas}/members-add.json +2 -2
  13. package/lib/{canary → schemas}/members-edit.json +5 -5
  14. package/lib/{canary → schemas}/members-upload.json +1 -1
  15. package/lib/{canary → schemas}/members.json +1 -1
  16. package/lib/{v3 → schemas}/pages-add.json +2 -2
  17. package/lib/{v3 → schemas}/pages-edit.json +2 -2
  18. package/lib/{canary → schemas}/pages.json +1 -1
  19. package/lib/{v3 → schemas}/posts-add.json +2 -2
  20. package/lib/{v3 → schemas}/posts-edit.json +2 -2
  21. package/lib/{canary → schemas}/posts.json +1 -1
  22. package/lib/{canary → schemas}/products-add.json +2 -2
  23. package/lib/{canary → schemas}/products-edit.json +2 -2
  24. package/lib/{canary → schemas}/products.json +3 -3
  25. package/lib/{v3 → schemas}/snippets-add.json +2 -2
  26. package/lib/{v3 → schemas}/snippets-edit.json +2 -2
  27. package/lib/{v3 → schemas}/snippets.json +1 -1
  28. package/lib/{v3 → schemas}/tags-add.json +2 -2
  29. package/lib/{v2 → schemas}/tags-edit.json +2 -2
  30. package/lib/{v3 → schemas}/tags.json +1 -1
  31. package/lib/{canary → schemas}/tiers-add.json +2 -2
  32. package/lib/{canary → schemas}/tiers-edit.json +2 -2
  33. package/lib/{canary → schemas}/tiers.json +1 -1
  34. package/lib/{v3 → schemas}/webhooks-add.json +2 -2
  35. package/lib/{v3 → schemas}/webhooks-edit.json +1 -1
  36. package/lib/{v3 → schemas}/webhooks.json +1 -1
  37. package/package.json +2 -2
  38. package/lib/canary/images-upload.json +0 -7
  39. package/lib/canary/images.json +0 -23
  40. package/lib/canary/labels-add.json +0 -22
  41. package/lib/canary/labels-edit.json +0 -17
  42. package/lib/canary/labels.json +0 -39
  43. package/lib/canary/members-add.json +0 -21
  44. package/lib/canary/pages-add.json +0 -21
  45. package/lib/canary/pages-edit.json +0 -21
  46. package/lib/canary/posts-add.json +0 -21
  47. package/lib/canary/posts-edit.json +0 -21
  48. package/lib/canary/snippets-add.json +0 -22
  49. package/lib/canary/snippets-edit.json +0 -22
  50. package/lib/canary/snippets.json +0 -39
  51. package/lib/canary/tags-add.json +0 -22
  52. package/lib/canary/tags-edit.json +0 -17
  53. package/lib/canary/tags.json +0 -112
  54. package/lib/canary/webhooks-add.json +0 -21
  55. package/lib/canary/webhooks-edit.json +0 -74
  56. package/lib/canary/webhooks.json +0 -67
  57. package/lib/v2/README.md +0 -8
  58. package/lib/v2/images-upload.json +0 -7
  59. package/lib/v2/index.js +0 -9
  60. package/lib/v2/pages-add.json +0 -21
  61. package/lib/v2/pages-edit.json +0 -21
  62. package/lib/v2/pages.json +0 -250
  63. package/lib/v2/posts-add.json +0 -21
  64. package/lib/v2/posts-edit.json +0 -21
  65. package/lib/v2/posts.json +0 -250
  66. package/lib/v2/tags-add.json +0 -22
  67. package/lib/v2/tags.json +0 -69
  68. package/lib/v3/README.md +0 -8
  69. package/lib/v3/images.json +0 -23
  70. package/lib/v3/index.js +0 -18
  71. package/lib/v3/members-edit.json +0 -74
  72. package/lib/v3/members-upload.json +0 -48
  73. package/lib/v3/members.json +0 -109
  74. package/lib/v3/pages.json +0 -250
  75. package/lib/v3/posts.json +0 -263
  76. package/lib/v3/tags-edit.json +0 -17
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tryghost/admin-api-schema",
3
- "version": "2.17.0",
3
+ "version": "3.0.0",
4
4
  "repository": "https://github.com/TryGhost/SDK/tree/master/packages/admin-api-schema",
5
5
  "author": "Ghost Foundation",
6
6
  "license": "MIT",
@@ -28,5 +28,5 @@
28
28
  "@tryghost/errors": "^1.0.0",
29
29
  "lodash": "^4.17.11"
30
30
  },
31
- "gitHead": "dd641499aeaaae6f491cc55e0f37be400f300a3c"
31
+ "gitHead": "460d932f6ebbe80fb3513f937db65925a7874ae0"
32
32
  }
@@ -1,7 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-07/schema#",
3
- "$id": "images.upload.canary",
4
- "title": "images.upload",
5
- "description": "Schema for images.upload",
6
- "$ref": "images.canary#/definitions/image"
7
- }
@@ -1,23 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-07/schema#",
3
- "$id": "images.canary",
4
- "title": "images",
5
- "description": "Base images definitions",
6
- "definitions": {
7
- "image": {
8
- "type": "object",
9
- "additionalProperties": false,
10
- "properties": {
11
- "purpose": {
12
- "type": "string",
13
- "enum": ["image", "profile_image", "icon"],
14
- "default": "image"
15
- },
16
- "ref": {
17
- "type": ["string", "null"],
18
- "maxLength": 2000
19
- }
20
- }
21
- }
22
- }
23
- }
@@ -1,22 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-07/schema#",
3
- "$id": "labels.add.canary",
4
- "title": "labels.add",
5
- "description": "Schema for labels.add",
6
- "type": "object",
7
- "additionalProperties": false,
8
- "properties": {
9
- "labels": {
10
- "type": "array",
11
- "minItems": 1,
12
- "maxItems": 1,
13
- "additionalProperties": false,
14
- "items": {
15
- "type": "object",
16
- "allOf": [{ "$ref": "labels.canary#/definitions/label" }],
17
- "required": ["name"]
18
- }
19
- }
20
- },
21
- "required": ["labels"]
22
- }
@@ -1,17 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-07/schema#",
3
- "$id": "labels.edit.canary",
4
- "title": "labels.edit",
5
- "description": "Schema for labels.edit",
6
- "type": "object",
7
- "additionalProperties": false,
8
- "properties": {
9
- "labels": {
10
- "type": "array",
11
- "minItems": 1,
12
- "maxItems": 1,
13
- "items": { "$ref": "labels.canary#/definitions/label" }
14
- }
15
- },
16
- "required": ["labels"]
17
- }
@@ -1,39 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-07/schema#",
3
- "$id": "labels.canary",
4
- "title": "labels",
5
- "description": "Base labels definitions",
6
- "definitions": {
7
- "label": {
8
- "type": "object",
9
- "additionalProperties": false,
10
- "properties": {
11
- "name": {
12
- "type": "string",
13
- "minLength": 1,
14
- "maxLength": 191,
15
- "pattern": "^([^,]|$)"
16
- },
17
- "slug": {
18
- "type": ["string", "null"],
19
- "maxLength": 191
20
- },
21
- "id": {
22
- "strip": true
23
- },
24
- "created_at": {
25
- "strip": true
26
- },
27
- "created_by": {
28
- "strip": true
29
- },
30
- "updated_at": {
31
- "strip": true
32
- },
33
- "updated_by": {
34
- "strip": true
35
- }
36
- }
37
- }
38
- }
39
- }
@@ -1,21 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-07/schema#",
3
- "$id": "members.add.canary",
4
- "title": "members.add",
5
- "description": "Schema for members.add",
6
- "type": "object",
7
- "additionalProperties": false,
8
- "properties": {
9
- "members": {
10
- "type": "array",
11
- "minItems": 1,
12
- "maxItems": 1,
13
- "items": {
14
- "type": "object",
15
- "allOf": [{ "$ref": "members.canary#/definitions/member" }],
16
- "required": ["email"]
17
- }
18
- }
19
- },
20
- "required": ["members"]
21
- }
@@ -1,21 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-07/schema#",
3
- "$id": "pages.add.canary",
4
- "title": "pages.add",
5
- "description": "Schema for pages.add",
6
- "type": "object",
7
- "additionalProperties": false,
8
- "properties": {
9
- "pages": {
10
- "type": "array",
11
- "minItems": 1,
12
- "maxItems": 1,
13
- "items": {
14
- "type": "object",
15
- "allOf": [{ "$ref": "pages.canary#/definitions/page" }],
16
- "required": ["title"]
17
- }
18
- }
19
- },
20
- "required": ["pages"]
21
- }
@@ -1,21 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-07/schema#",
3
- "$id": "pages.edit.canary",
4
- "title": "pages.edit",
5
- "description": "Schema for pages.edit",
6
- "type": "object",
7
- "additionalProperties": false,
8
- "properties": {
9
- "pages": {
10
- "type": "array",
11
- "minItems": 1,
12
- "maxItems": 1,
13
- "items": {
14
- "type": "object",
15
- "allOf": [{ "$ref": "pages.canary#/definitions/page" }],
16
- "required": ["updated_at"]
17
- }
18
- }
19
- },
20
- "required": ["pages"]
21
- }
@@ -1,21 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-07/schema#",
3
- "$id": "posts.add.canary",
4
- "title": "posts.add",
5
- "description": "Schema for posts.add",
6
- "type": "object",
7
- "additionalProperties": false,
8
- "properties": {
9
- "posts": {
10
- "type": "array",
11
- "minItems": 1,
12
- "maxItems": 1,
13
- "items": {
14
- "type": "object",
15
- "allOf": [{ "$ref": "posts.canary#/definitions/post" }],
16
- "required": ["title"]
17
- }
18
- }
19
- },
20
- "required": ["posts"]
21
- }
@@ -1,21 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-07/schema#",
3
- "$id": "posts.edit.canary",
4
- "title": "posts.edit",
5
- "description": "Schema for posts.edit",
6
- "type": "object",
7
- "additionalProperties": false,
8
- "properties": {
9
- "posts": {
10
- "type": "array",
11
- "minItems": 1,
12
- "maxItems": 1,
13
- "items": {
14
- "type": "object",
15
- "allOf": [{ "$ref": "posts.canary#/definitions/post" }],
16
- "required": ["updated_at"]
17
- }
18
- }
19
- },
20
- "required": ["posts"]
21
- }
@@ -1,22 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-07/schema#",
3
- "$id": "snippets.add.canary",
4
- "title": "snippets.add",
5
- "description": "Schema for snippets.add",
6
- "type": "object",
7
- "additionalProperties": false,
8
- "properties": {
9
- "snippets": {
10
- "type": "array",
11
- "minItems": 1,
12
- "maxItems": 1,
13
- "additionalProperties": false,
14
- "items": {
15
- "type": "object",
16
- "allOf": [{ "$ref": "snippets.canary#/definitions/snippet" }],
17
- "required": ["name", "mobiledoc"]
18
- }
19
- }
20
- },
21
- "required": ["snippets"]
22
- }
@@ -1,22 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-07/schema#",
3
- "$id": "snippets.edit.canary",
4
- "title": "snippets.edit",
5
- "description": "Schema for snippets.edit",
6
- "type": "object",
7
- "additionalProperties": false,
8
- "properties": {
9
- "snippets": {
10
- "type": "array",
11
- "minItems": 1,
12
- "maxItems": 1,
13
- "additionalProperties": false,
14
- "items": {
15
- "type": "object",
16
- "allOf": [{ "$ref": "snippets.canary#/definitions/snippet" }],
17
- "required": ["name", "mobiledoc"]
18
- }
19
- }
20
- },
21
- "required": ["snippets"]
22
- }
@@ -1,39 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-07/schema#",
3
- "$id": "snippets.canary",
4
- "title": "snippets",
5
- "description": "Base snippets definitions",
6
- "definitions": {
7
- "snippet": {
8
- "type": "object",
9
- "additionalProperties": false,
10
- "properties": {
11
- "name": {
12
- "type": "string",
13
- "minLength": 1,
14
- "maxLength": 191
15
- },
16
- "mobiledoc": {
17
- "type": "string",
18
- "format": "json-string",
19
- "maxLength": 1000000000
20
- },
21
- "id": {
22
- "strip": true
23
- },
24
- "created_at": {
25
- "strip": true
26
- },
27
- "created_by": {
28
- "strip": true
29
- },
30
- "updated_at": {
31
- "strip": true
32
- },
33
- "updated_by": {
34
- "strip": true
35
- }
36
- }
37
- }
38
- }
39
- }
@@ -1,22 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-07/schema#",
3
- "$id": "tags.add.canary",
4
- "title": "tags.add",
5
- "description": "Schema for tags.add",
6
- "type": "object",
7
- "additionalProperties": false,
8
- "properties": {
9
- "tags": {
10
- "type": "array",
11
- "minItems": 1,
12
- "maxItems": 1,
13
- "additionalProperties": false,
14
- "items": {
15
- "type": "object",
16
- "allOf": [{ "$ref": "tags.canary#/definitions/tag" }],
17
- "required": ["name"]
18
- }
19
- }
20
- },
21
- "required": ["tags"]
22
- }
@@ -1,17 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-07/schema#",
3
- "$id": "tags.edit.canary",
4
- "title": "tags.edit",
5
- "description": "Schema for tags.edit",
6
- "type": "object",
7
- "additionalProperties": false,
8
- "properties": {
9
- "tags": {
10
- "type": "array",
11
- "minItems": 1,
12
- "maxItems": 1,
13
- "items": { "$ref": "tags.canary#/definitions/tag" }
14
- }
15
- },
16
- "required": ["tags"]
17
- }
@@ -1,112 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-07/schema#",
3
- "$id": "tags.canary",
4
- "title": "tags",
5
- "description": "Base tags definitions",
6
- "definitions": {
7
- "tag": {
8
- "type": "object",
9
- "additionalProperties": false,
10
- "properties": {
11
- "name": {
12
- "type": "string",
13
- "minLength": 1,
14
- "maxLength": 191,
15
- "pattern": "^([^,]|$)"
16
- },
17
- "slug": {
18
- "type": ["string", "null"],
19
- "maxLength": 191
20
- },
21
- "description": {
22
- "type": ["string", "null"],
23
- "maxLength": 500
24
- },
25
- "feature_image": {
26
- "type": ["string", "null"],
27
- "format": "uri-reference",
28
- "maxLength": 2000
29
- },
30
- "visibility": {
31
- "type": "string",
32
- "enum": ["public", "internal"]
33
- },
34
- "meta_title": {
35
- "type": ["string", "null"],
36
- "maxLength": 300
37
- },
38
- "meta_description": {
39
- "type": ["string", "null"],
40
- "maxLength": 500
41
- },
42
- "og_image": {
43
- "type": ["string", "null"],
44
- "format": "uri-reference",
45
- "maxLength": 2000
46
- },
47
- "og_title": {
48
- "type": ["string", "null"],
49
- "maxLength": 300
50
- },
51
- "og_description": {
52
- "type": ["string", "null"],
53
- "maxLength": 500
54
- },
55
- "twitter_image": {
56
- "type": ["string", "null"],
57
- "format": "uri-reference",
58
- "maxLength": 2000
59
- },
60
- "twitter_title": {
61
- "type": ["string", "null"],
62
- "maxLength": 300
63
- },
64
- "twitter_description": {
65
- "type": ["string", "null"],
66
- "maxLength": 500
67
- },
68
- "codeinjection_head": {
69
- "type": ["string", "null"],
70
- "maxLength": 65535
71
- },
72
- "codeinjection_foot": {
73
- "type": ["string", "null"],
74
- "maxLength": 65535
75
- },
76
- "canonical_url": {
77
- "type": ["string", "null"],
78
- "format": "uri-reference",
79
- "maxLength": 2000
80
- },
81
- "accent_color": {
82
- "type": ["string", "null"],
83
- "maxLength": 50
84
- },
85
- "id": {
86
- "strip": true
87
- },
88
- "parent": {
89
- "strip": true
90
- },
91
- "parent_id": {
92
- "strip": true
93
- },
94
- "created_at": {
95
- "strip": true
96
- },
97
- "created_by": {
98
- "strip": true
99
- },
100
- "updated_at": {
101
- "strip": true
102
- },
103
- "updated_by": {
104
- "strip": true
105
- },
106
- "url": {
107
- "strip": true
108
- }
109
- }
110
- }
111
- }
112
- }
@@ -1,21 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-07/schema#",
3
- "$id": "webhooks.add.canary",
4
- "title": "webhooks.add",
5
- "description": "Schema for webhooks.add",
6
- "type": "object",
7
- "additionalProperties": false,
8
- "properties": {
9
- "webhooks": {
10
- "type": "array",
11
- "minItems": 1,
12
- "maxItems": 1,
13
- "items": {
14
- "type": "object",
15
- "allOf": [{ "$ref": "webhooks.canary#/definitions/webhook" }],
16
- "required": ["event", "target_url"]
17
- }
18
- }
19
- },
20
- "required": ["webhooks"]
21
- }
@@ -1,74 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-07/schema#",
3
- "$id": "webhooks.edit.canary",
4
- "title": "webhooks.edit",
5
- "description": "Schema for webhooks.edit",
6
- "type": "object",
7
- "additionalProperties": false,
8
- "properties": {
9
- "webhooks": {
10
- "type": "array",
11
- "minItems": 1,
12
- "maxItems": 1,
13
- "items": {
14
- "type": "object",
15
- "additionalProperties": false,
16
- "properties": {
17
- "event": {
18
- "type": "string",
19
- "maxLength": 50,
20
- "isLowercase": true
21
- },
22
- "target_url": {
23
- "type": "string",
24
- "format": "uri-reference",
25
- "maxLength": 2000
26
- },
27
- "name": {
28
- "type": ["string", "null"],
29
- "maxLength": 191
30
- },
31
- "secret": {
32
- "type": ["string", "null"],
33
- "maxLength": 191
34
- },
35
- "api_version": {
36
- "type": ["string", "null"],
37
- "maxLength": 50
38
- },
39
- "integration_id": {
40
- "strip": true
41
- },
42
- "id": {
43
- "strip": true
44
- },
45
- "status": {
46
- "strip": true
47
- },
48
- "last_triggered_at": {
49
- "strip": true
50
- },
51
- "last_triggered_status": {
52
- "strip": true
53
- },
54
- "last_triggered_error": {
55
- "strip": true
56
- },
57
- "created_at": {
58
- "strip": true
59
- },
60
- "created_by": {
61
- "strip": true
62
- },
63
- "updated_at": {
64
- "strip": true
65
- },
66
- "updated_by": {
67
- "strip": true
68
- }
69
- }
70
- }
71
- }
72
- },
73
- "required": ["webhooks"]
74
- }
@@ -1,67 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-07/schema#",
3
- "$id": "webhooks.canary",
4
- "title": "webhooks",
5
- "description": "Base webhooks definitions",
6
- "definitions": {
7
- "webhook": {
8
- "type": "object",
9
- "additionalProperties": false,
10
- "properties": {
11
- "event": {
12
- "type": "string",
13
- "maxLength": 50,
14
- "isLowercase": true
15
- },
16
- "target_url": {
17
- "type": "string",
18
- "format": "uri-reference",
19
- "maxLength": 2000
20
- },
21
- "name": {
22
- "type": ["string", "null"],
23
- "maxLength": 191
24
- },
25
- "secret": {
26
- "type": ["string", "null"],
27
- "maxLength": 191
28
- },
29
- "api_version": {
30
- "type": ["string", "null"],
31
- "maxLength": 50
32
- },
33
- "integration_id": {
34
- "type": ["string", "null"],
35
- "maxLength": 24
36
- },
37
- "id": {
38
- "strip": true
39
- },
40
- "status": {
41
- "strip": true
42
- },
43
- "last_triggered_at": {
44
- "strip": true
45
- },
46
- "last_triggered_status": {
47
- "strip": true
48
- },
49
- "last_triggered_error": {
50
- "strip": true
51
- },
52
- "created_at": {
53
- "strip": true
54
- },
55
- "created_by": {
56
- "strip": true
57
- },
58
- "updated_at": {
59
- "strip": true
60
- },
61
- "updated_by": {
62
- "strip": true
63
- }
64
- }
65
- }
66
- }
67
- }
package/lib/v2/README.md DELETED
@@ -1,8 +0,0 @@
1
- # JSON Schema structuring convention
2
-
3
- When adding a new schema or definition following naming convention should be followed:
4
- 1. Name the file containing JSON definitions in the same way as resource is named in the API (aka "docName" in controller config). For example, for [tags](https://github.com/TryGhost/Ghost/blob/2a921b86598184fcd5a2d95fefae4283bba1042a/core/server/api/canary/tags.js#L9) the definitions file would be `tags.json`
5
- 2. Name the file containing JSON schema (which usually references "definitions") using following convention `{resourceName}-{methodName}.json`. For example, for [tags.edit](https://github.com/TryGhost/Ghost/blob/master/core/server/api/canary/tags.js#L89) method file would be named `tags-edit.json`
6
- 3. Update `index.js` list with a new definition name
7
-
8
- The need to have separate "definitions" and "schema" files comes from [schema reusability pattern](https://cswr.github.io/JsonSchema/spec/definitions_references/) that JSON schema allows for through $ref keyword. In some cases, the pattern doesn't quite work out because of limitations of the syntax (cannot override parts of referenced definition). Generally try to reuse as much schema as possible to avoid duplication unless it becomes painful to do so.
@@ -1,7 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-07/schema#",
3
- "$id": "images.upload.v2",
4
- "title": "images.upload",
5
- "description": "Schema for images.upload",
6
- "$ref": "images.v2#/definitions/image"
7
- }
package/lib/v2/index.js DELETED
@@ -1,9 +0,0 @@
1
- module.exports = [
2
- 'images-upload',
3
- 'pages-add',
4
- 'pages-edit',
5
- 'posts-add',
6
- 'posts-edit',
7
- 'tags-add',
8
- 'tags-edit'
9
- ];