@tryghost/admin-api-schema 2.16.0 → 3.1.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 (77) 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 +7 -4
  14. package/lib/{canary → schemas}/members-upload.json +1 -1
  15. package/lib/{canary → schemas}/members.json +4 -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 +5 -2
  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/lib/utils/json-schema.js +1 -0
  38. package/package.json +2 -2
  39. package/lib/canary/images-upload.json +0 -7
  40. package/lib/canary/images.json +0 -23
  41. package/lib/canary/labels-add.json +0 -22
  42. package/lib/canary/labels-edit.json +0 -17
  43. package/lib/canary/labels.json +0 -39
  44. package/lib/canary/members-add.json +0 -21
  45. package/lib/canary/pages-add.json +0 -21
  46. package/lib/canary/pages-edit.json +0 -21
  47. package/lib/canary/posts-add.json +0 -21
  48. package/lib/canary/posts-edit.json +0 -21
  49. package/lib/canary/snippets-add.json +0 -22
  50. package/lib/canary/snippets-edit.json +0 -22
  51. package/lib/canary/snippets.json +0 -39
  52. package/lib/canary/tags-add.json +0 -22
  53. package/lib/canary/tags-edit.json +0 -17
  54. package/lib/canary/tags.json +0 -112
  55. package/lib/canary/webhooks-add.json +0 -21
  56. package/lib/canary/webhooks-edit.json +0 -74
  57. package/lib/canary/webhooks.json +0 -67
  58. package/lib/v2/README.md +0 -8
  59. package/lib/v2/images-upload.json +0 -7
  60. package/lib/v2/index.js +0 -9
  61. package/lib/v2/pages-add.json +0 -21
  62. package/lib/v2/pages-edit.json +0 -21
  63. package/lib/v2/pages.json +0 -250
  64. package/lib/v2/posts-add.json +0 -21
  65. package/lib/v2/posts-edit.json +0 -21
  66. package/lib/v2/posts.json +0 -250
  67. package/lib/v2/tags-add.json +0 -22
  68. package/lib/v2/tags.json +0 -69
  69. package/lib/v3/README.md +0 -8
  70. package/lib/v3/images.json +0 -23
  71. package/lib/v3/index.js +0 -18
  72. package/lib/v3/members-edit.json +0 -74
  73. package/lib/v3/members-upload.json +0 -48
  74. package/lib/v3/members.json +0 -109
  75. package/lib/v3/pages.json +0 -250
  76. package/lib/v3/posts.json +0 -263
  77. package/lib/v3/tags-edit.json +0 -17
@@ -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
- ];
@@ -1,21 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-07/schema#",
3
- "$id": "pages.add.v2",
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.v2#/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.v2",
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.v2#/definitions/page" }],
16
- "required": ["updated_at"]
17
- }
18
- }
19
- },
20
- "required": ["pages"]
21
- }
package/lib/v2/pages.json DELETED
@@ -1,250 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-07/schema#",
3
- "$id": "pages.v2",
4
- "title": "pages",
5
- "description": "Base pages definitions",
6
- "definitions": {
7
- "page": {
8
- "type": "object",
9
- "additionalProperties": false,
10
- "properties": {
11
- "title": {
12
- "type": "string",
13
- "maxLength": 2000
14
- },
15
- "slug": {
16
- "type": "string",
17
- "maxLength": 191
18
- },
19
- "mobiledoc": {
20
- "type": ["string", "null"],
21
- "format": "json-string",
22
- "maxLength": 1000000000
23
- },
24
- "html": {
25
- "type": ["string", "null"],
26
- "maxLength": 1000000000
27
- },
28
- "feature_image": {
29
- "type": ["string", "null"],
30
- "format": "uri-reference",
31
- "maxLength": 2000
32
- },
33
- "featured": {
34
- "type": "boolean"
35
- },
36
- "status": {
37
- "type": "string",
38
- "enum": ["published", "draft", "scheduled"]
39
- },
40
- "locale": {
41
- "type": ["string", "null"],
42
- "maxLength": 6
43
- },
44
- "visibility": {
45
- "type": ["string", "null"]
46
- },
47
- "meta_title": {
48
- "type": ["string", "null"],
49
- "maxLength": 300
50
- },
51
- "meta_description": {
52
- "type": ["string", "null"],
53
- "maxLength": 500
54
- },
55
- "updated_at": {
56
- "type": ["string", "null"],
57
- "format": "date-time"
58
- },
59
- "published_at": {
60
- "type": ["string", "null"],
61
- "format": "date-time"
62
- },
63
- "custom_excerpt": {
64
- "type": ["string", "null"],
65
- "maxLength": 300
66
- },
67
- "codeinjection_head": {
68
- "type": ["string", "null"],
69
- "maxLength": 65535
70
- },
71
- "codeinjection_foot": {
72
- "type": ["string", "null"],
73
- "maxLength": 65535
74
- },
75
- "og_image": {
76
- "type": ["string", "null"],
77
- "format": "uri-reference",
78
- "maxLength": 2000
79
- },
80
- "og_title": {
81
- "type": ["string", "null"],
82
- "maxLength": 300
83
- },
84
- "og_description": {
85
- "type": ["string", "null"],
86
- "maxLength": 500
87
- },
88
- "twitter_image": {
89
- "type": ["string", "null"],
90
- "format": "uri-reference",
91
- "maxLength": 2000
92
- },
93
- "twitter_title": {
94
- "type": ["string", "null"],
95
- "maxLength": 300
96
- },
97
- "twitter_description": {
98
- "type": ["string", "null"],
99
- "maxLength": 500
100
- },
101
- "custom_template": {
102
- "type": ["string", "null"],
103
- "maxLength": 100
104
- },
105
- "canonical_url": {
106
- "type": ["string", "null"],
107
- "format": "uri-reference",
108
- "maxLength": 2000
109
- },
110
- "authors": {
111
- "$ref": "#/definitions/page-authors"
112
- },
113
- "tags": {
114
- "$ref": "#/definitions/page-tags"
115
- },
116
- "id": {
117
- "strip": true
118
- },
119
- "page": {
120
- "strip": true
121
- },
122
- "author": {
123
- "strip": true
124
- },
125
- "author_id": {
126
- "strip": true
127
- },
128
- "created_at": {
129
- "strip": true
130
- },
131
- "created_by": {
132
- "strip": true
133
- },
134
- "updated_by": {
135
- "strip": true
136
- },
137
- "published_by": {
138
- "strip": true
139
- },
140
- "url": {
141
- "strip": true
142
- },
143
- "primary_tag": {
144
- "strip": true
145
- },
146
- "primary_author": {
147
- "strip": true
148
- },
149
- "excerpt": {
150
- "strip": true
151
- },
152
- "plaintext": {
153
- "strip": true
154
- },
155
- "frontmatter": {
156
- "strip": true
157
- }
158
- }
159
- },
160
- "page-authors": {
161
- "description": "Authors of the page",
162
- "type": "array",
163
- "items": {
164
- "anyOf": [
165
- {
166
- "type": "object",
167
- "properties": {
168
- "id": {
169
- "type": "string",
170
- "maxLength": 24
171
- },
172
- "slug": {
173
- "type": "string",
174
- "maxLength": 191
175
- },
176
- "email": {
177
- "type": "string",
178
- "maxLength": 191
179
- },
180
- "roles": {
181
- "strip": true
182
- },
183
- "permissions": {
184
- "strip": true
185
- }
186
- },
187
- "anyOf": [
188
- { "required": ["id"] },
189
- { "required": ["slug"] },
190
- { "required": ["email"] }
191
- ]
192
- },
193
- {
194
- "type": "string",
195
- "maxLength": 191
196
- }
197
- ]
198
- }
199
- },
200
- "page-tags": {
201
- "description": "Tags of the page",
202
- "type": "array",
203
- "items": {
204
- "anyOf": [
205
- {
206
- "type": "object",
207
- "properties": {
208
- "id": {
209
- "type": "string",
210
- "maxLength": 24
211
- },
212
- "name": {
213
- "type": "string",
214
- "maxLength": 191
215
- },
216
- "slug": {
217
- "type": ["string", "null"],
218
- "maxLength": 191
219
- },
220
- "parent": {
221
- "strip": true
222
- },
223
- "parent_id": {
224
- "strip": true
225
- },
226
- "pages": {
227
- "strip": true
228
- }
229
- },
230
- "anyOf": [
231
- {
232
- "required": ["id"]
233
- },
234
- {
235
- "required": ["name"]
236
- },
237
- {
238
- "required": ["slug"]
239
- }
240
- ]
241
- },
242
- {
243
- "type": "string",
244
- "maxLength": 191
245
- }
246
- ]
247
- }
248
- }
249
- }
250
- }
@@ -1,21 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-07/schema#",
3
- "$id": "posts.add.v2",
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.v2#/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.v2",
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.v2#/definitions/post" }],
16
- "required": ["updated_at"]
17
- }
18
- }
19
- },
20
- "required": ["posts"]
21
- }
package/lib/v2/posts.json DELETED
@@ -1,250 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-07/schema#",
3
- "$id": "posts.v2",
4
- "title": "posts",
5
- "description": "Base posts definitions",
6
- "definitions": {
7
- "post": {
8
- "type": "object",
9
- "additionalProperties": false,
10
- "properties": {
11
- "title": {
12
- "type": "string",
13
- "maxLength": 2000
14
- },
15
- "slug": {
16
- "type": "string",
17
- "maxLength": 191
18
- },
19
- "mobiledoc": {
20
- "type": ["string", "null"],
21
- "format": "json-string",
22
- "maxLength": 1000000000
23
- },
24
- "html": {
25
- "type": ["string", "null"],
26
- "maxLength": 1000000000
27
- },
28
- "feature_image": {
29
- "type": ["string", "null"],
30
- "format": "uri-reference",
31
- "maxLength": 2000
32
- },
33
- "featured": {
34
- "type": "boolean"
35
- },
36
- "status": {
37
- "type": "string",
38
- "enum": ["published", "draft", "scheduled"]
39
- },
40
- "locale": {
41
- "type": ["string", "null"],
42
- "maxLength": 6
43
- },
44
- "visibility": {
45
- "type": ["string", "null"]
46
- },
47
- "meta_title": {
48
- "type": ["string", "null"],
49
- "maxLength": 300
50
- },
51
- "meta_description": {
52
- "type": ["string", "null"],
53
- "maxLength": 500
54
- },
55
- "updated_at": {
56
- "type": ["string", "null"],
57
- "format": "date-time"
58
- },
59
- "published_at": {
60
- "type": ["string", "null"],
61
- "format": "date-time"
62
- },
63
- "custom_excerpt": {
64
- "type": ["string", "null"],
65
- "maxLength": 300
66
- },
67
- "codeinjection_head": {
68
- "type": ["string", "null"],
69
- "maxLength": 65535
70
- },
71
- "codeinjection_foot": {
72
- "type": ["string", "null"],
73
- "maxLength": 65535
74
- },
75
- "og_image": {
76
- "type": ["string", "null"],
77
- "format": "uri-reference",
78
- "maxLength": 2000
79
- },
80
- "og_title": {
81
- "type": ["string", "null"],
82
- "maxLength": 300
83
- },
84
- "og_description": {
85
- "type": ["string", "null"],
86
- "maxLength": 500
87
- },
88
- "twitter_image": {
89
- "type": ["string", "null"],
90
- "format": "uri-reference",
91
- "maxLength": 2000
92
- },
93
- "twitter_title": {
94
- "type": ["string", "null"],
95
- "maxLength": 300
96
- },
97
- "twitter_description": {
98
- "type": ["string", "null"],
99
- "maxLength": 500
100
- },
101
- "custom_template": {
102
- "type": ["string", "null"],
103
- "maxLength": 100
104
- },
105
- "canonical_url": {
106
- "type": ["string", "null"],
107
- "format": "uri-reference",
108
- "maxLength": 2000
109
- },
110
- "authors": {
111
- "$ref": "#/definitions/post-authors"
112
- },
113
- "tags": {
114
- "$ref": "#/definitions/post-tags"
115
- },
116
- "id": {
117
- "strip": true
118
- },
119
- "uuid": {
120
- "strip": true
121
- },
122
- "comment_id": {
123
- "strip": true
124
- },
125
- "author": {
126
- "strip": true
127
- },
128
- "author_id": {
129
- "strip": true
130
- },
131
- "page": {
132
- "strip": true
133
- },
134
- "created_at": {
135
- "strip": true
136
- },
137
- "created_by": {
138
- "strip": true
139
- },
140
- "updated_by": {
141
- "strip": true
142
- },
143
- "published_by": {
144
- "strip": true
145
- },
146
- "url": {
147
- "strip": true
148
- },
149
- "primary_tag": {
150
- "strip": true
151
- },
152
- "primary_author": {
153
- "strip": true
154
- },
155
- "excerpt": {
156
- "strip": true
157
- },
158
- "plaintext": {
159
- "strip": true
160
- },
161
- "frontmatter": {
162
- "strip": true
163
- }
164
- }
165
- },
166
- "post-authors": {
167
- "description": "Authors of the post",
168
- "type": "array",
169
- "items": {
170
- "anyOf": [
171
- {
172
- "type": "object",
173
- "properties": {
174
- "id": {
175
- "type": "string",
176
- "maxLength": 24
177
- },
178
- "slug": {
179
- "type": "string",
180
- "maxLength": 191
181
- },
182
- "email": {
183
- "type": "string",
184
- "maxLength": 191
185
- },
186
- "roles": {
187
- "strip": true
188
- },
189
- "permissions": {
190
- "strip": true
191
- }
192
- },
193
- "anyOf": [
194
- { "required": ["id"] },
195
- { "required": ["slug"] },
196
- { "required": ["email"] }
197
- ]
198
- },
199
- {
200
- "type": "string",
201
- "maxLength": 191
202
- }
203
- ]
204
- }
205
- },
206
- "post-tags": {
207
- "description": "Tags of the post",
208
- "type": "array",
209
- "items": {
210
- "anyOf": [
211
- {
212
- "type": "object",
213
- "properties": {
214
- "id": {
215
- "type": "string",
216
- "maxLength": 24
217
- },
218
- "name": {
219
- "type": "string",
220
- "maxLength": 191
221
- },
222
- "slug": {
223
- "type": ["string", "null"],
224
- "maxLength": 191
225
- },
226
- "parent": {
227
- "strip": true
228
- },
229
- "parent_id": {
230
- "strip": true
231
- },
232
- "posts": {
233
- "strip": true
234
- }
235
- },
236
- "anyOf": [
237
- { "required": ["id"] },
238
- { "required": ["name"] },
239
- { "required": ["slug"] }
240
- ]
241
- },
242
- {
243
- "type": "string",
244
- "maxLength": 191
245
- }
246
- ]
247
- }
248
- }
249
- }
250
- }