@tryghost/admin-api-schema 3.2.1 → 4.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.
@@ -17,21 +17,6 @@
17
17
  "slug": {
18
18
  "type": ["string", "null"],
19
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
20
  }
36
21
  }
37
22
  }
@@ -25,9 +25,6 @@
25
25
  "maxLength": 191,
26
26
  "pattern": "^([^,]|$)"
27
27
  },
28
- "avatar_image": {
29
- "strip": true
30
- },
31
28
  "note": {
32
29
  "type": "string",
33
30
  "minLength": 0,
@@ -42,9 +39,6 @@
42
39
  "comped": {
43
40
  "type": "boolean"
44
41
  },
45
- "id": {
46
- "strip": true
47
- },
48
42
  "products": {
49
43
  "$ref": "members#/definitions/member-products"
50
44
  },
@@ -56,30 +50,6 @@
56
50
  },
57
51
  "labels": {
58
52
  "$ref": "members#/definitions/member-labels"
59
- },
60
- "email_count": {
61
- "strip": true
62
- },
63
- "email_opened_count": {
64
- "strip": true
65
- },
66
- "email_open_rate": {
67
- "strip": true
68
- },
69
- "email_recipients": {
70
- "strip": true
71
- },
72
- "created_at": {
73
- "strip": true
74
- },
75
- "created_by": {
76
- "strip": true
77
- },
78
- "updated_at": {
79
- "strip": true
80
- },
81
- "updated_by": {
82
- "strip": true
83
53
  }
84
54
  }
85
55
  }
@@ -20,9 +20,6 @@
20
20
  "maxLength": 191,
21
21
  "pattern": "^([^,]|$)"
22
22
  },
23
- "avatar_image": {
24
- "strip": true
25
- },
26
23
  "note": {
27
24
  "type": ["string", "null"],
28
25
  "minLength": 0,
@@ -19,9 +19,6 @@
19
19
  "maxLength": 191,
20
20
  "pattern": "^([^,]|$)"
21
21
  },
22
- "avatar_image": {
23
- "strip": true
24
- },
25
22
  "note": {
26
23
  "type": "string",
27
24
  "minLength": 0,
@@ -39,9 +36,6 @@
39
36
  "subscriptions": {
40
37
  "type": "array"
41
38
  },
42
- "id": {
43
- "strip": true
44
- },
45
39
  "labels": {
46
40
  "$ref": "#/definitions/member-labels"
47
41
  },
@@ -53,30 +47,6 @@
53
47
  },
54
48
  "newsletters": {
55
49
  "$ref": "#/definitions/member-newsletters"
56
- },
57
- "email_count": {
58
- "strip": true
59
- },
60
- "email_opened_count": {
61
- "strip": true
62
- },
63
- "email_open_rate": {
64
- "strip": true
65
- },
66
- "email_recipients": {
67
- "strip": true
68
- },
69
- "created_at": {
70
- "strip": true
71
- },
72
- "created_by": {
73
- "strip": true
74
- },
75
- "updated_at": {
76
- "strip": true
77
- },
78
- "updated_by": {
79
- "strip": true
80
50
  }
81
51
  }
82
52
  },
@@ -162,9 +132,6 @@
162
132
  "slug": {
163
133
  "type": ["string", "null"],
164
134
  "maxLength": 191
165
- },
166
- "members": {
167
- "strip": true
168
135
  }
169
136
  },
170
137
  "anyOf": [
@@ -126,48 +126,6 @@
126
126
  },
127
127
  "tags": {
128
128
  "$ref": "#/definitions/page-tags"
129
- },
130
- "id": {
131
- "strip": true
132
- },
133
- "page": {
134
- "strip": true
135
- },
136
- "author": {
137
- "strip": true
138
- },
139
- "author_id": {
140
- "strip": true
141
- },
142
- "created_at": {
143
- "strip": true
144
- },
145
- "created_by": {
146
- "strip": true
147
- },
148
- "updated_by": {
149
- "strip": true
150
- },
151
- "published_by": {
152
- "strip": true
153
- },
154
- "url": {
155
- "strip": true
156
- },
157
- "primary_tag": {
158
- "strip": true
159
- },
160
- "primary_author": {
161
- "strip": true
162
- },
163
- "excerpt": {
164
- "strip": true
165
- },
166
- "plaintext": {
167
- "strip": true
168
- },
169
- "frontmatter": {
170
- "strip": true
171
129
  }
172
130
  }
173
131
  },
@@ -224,12 +182,6 @@
224
182
  "email": {
225
183
  "type": "string",
226
184
  "maxLength": 191
227
- },
228
- "roles": {
229
- "strip": true
230
- },
231
- "permissions": {
232
- "strip": true
233
185
  }
234
186
  },
235
187
  "anyOf": [
@@ -264,15 +216,6 @@
264
216
  "slug": {
265
217
  "type": ["string", "null"],
266
218
  "maxLength": 191
267
- },
268
- "parent": {
269
- "strip": true
270
- },
271
- "parent_id": {
272
- "strip": true
273
- },
274
- "pages": {
275
- "strip": true
276
219
  }
277
220
  },
278
221
  "anyOf": [
@@ -133,66 +133,6 @@
133
133
  },
134
134
  "tags": {
135
135
  "$ref": "#/definitions/post-tags"
136
- },
137
- "id": {
138
- "strip": true
139
- },
140
- "uuid": {
141
- "strip": true
142
- },
143
- "comment_id": {
144
- "strip": true
145
- },
146
- "author": {
147
- "strip": true
148
- },
149
- "author_id": {
150
- "strip": true
151
- },
152
- "page": {
153
- "strip": true
154
- },
155
- "created_at": {
156
- "strip": true
157
- },
158
- "created_by": {
159
- "strip": true
160
- },
161
- "updated_by": {
162
- "strip": true
163
- },
164
- "published_by": {
165
- "strip": true
166
- },
167
- "url": {
168
- "strip": true
169
- },
170
- "primary_tag": {
171
- "strip": true
172
- },
173
- "primary_author": {
174
- "strip": true
175
- },
176
- "excerpt": {
177
- "strip": true
178
- },
179
- "plaintext": {
180
- "strip": true
181
- },
182
- "email": {
183
- "strip": true
184
- },
185
- "send_email_when_published": {
186
- "strip": true
187
- },
188
- "email_recipient_filter": {
189
- "strip": true
190
- },
191
- "frontmatter": {
192
- "strip": true
193
- },
194
- "newsletter": {
195
- "strip": true
196
136
  }
197
137
  }
198
138
  },
@@ -249,12 +189,6 @@
249
189
  "email": {
250
190
  "type": "string",
251
191
  "maxLength": 191
252
- },
253
- "roles": {
254
- "strip": true
255
- },
256
- "permissions": {
257
- "strip": true
258
192
  }
259
193
  },
260
194
  "anyOf": [
@@ -289,15 +223,6 @@
289
223
  "slug": {
290
224
  "type": ["string", "null"],
291
225
  "maxLength": 191
292
- },
293
- "parent": {
294
- "strip": true
295
- },
296
- "parent_id": {
297
- "strip": true
298
- },
299
- "posts": {
300
- "strip": true
301
226
  }
302
227
  },
303
228
  "anyOf": [
@@ -24,12 +24,6 @@
24
24
  "active": {
25
25
  "type": "boolean"
26
26
  },
27
- "updated_at": {
28
- "strip": true
29
- },
30
- "created_at": {
31
- "strip": true
32
- },
33
27
  "stripe_prices": {
34
28
  "type": ["array", "null"],
35
29
  "items": {
@@ -82,12 +76,6 @@
82
76
  "interval": {
83
77
  "type": ["string", "null"],
84
78
  "enum": ["year", "month", "week", "day"]
85
- },
86
- "updated_at": {
87
- "strip": true
88
- },
89
- "created_at": {
90
- "strip": true
91
79
  }
92
80
  }
93
81
  },
@@ -106,12 +94,6 @@
106
94
  "slug": {
107
95
  "type": "string",
108
96
  "maxLength": 191
109
- },
110
- "updated_at": {
111
- "strip": true
112
- },
113
- "created_at": {
114
- "strip": true
115
97
  }
116
98
  },
117
99
  "anyOf": [
@@ -17,21 +17,6 @@
17
17
  "type": "string",
18
18
  "format": "json-string",
19
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
20
  }
36
21
  }
37
22
  }
@@ -81,30 +81,6 @@
81
81
  "accent_color": {
82
82
  "type": ["string", "null"],
83
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
84
  }
109
85
  }
110
86
  }
@@ -9,9 +9,6 @@
9
9
  "type": "object",
10
10
  "additionalProperties": false,
11
11
  "properties": {
12
- "id": {
13
- "strip": true
14
- },
15
12
  "name": {
16
13
  "type": "string",
17
14
  "maxLength": 191
@@ -35,104 +32,22 @@
35
32
  "type": "string",
36
33
  "enum": ["public", "none"]
37
34
  },
38
- "updated_at": {
39
- "strip": true
40
- },
41
- "type": {
42
- "strip": true
43
- },
44
- "created_at": {
45
- "strip": true
35
+ "currency": {
36
+ "type": ["string", "null"]
46
37
  },
47
38
  "monthly_price": {
48
- "$ref": "#/definitions/tier-price"
39
+ "type": ["number", "null"]
49
40
  },
50
41
  "yearly_price": {
51
- "$ref": "#/definitions/tier-price"
42
+ "type": ["number", "null"]
52
43
  },
53
44
  "benefits": {
54
45
  "type": ["array", "null"],
55
46
  "items": {
56
- "$ref": "#/definitions/tier-benefit"
47
+ "type": "string"
57
48
  }
58
49
  }
59
50
  }
60
- },
61
- "tier-price": {
62
- "description": "A Stripe Price associated with a Tier",
63
- "type": ["object", "null"],
64
- "properties": {
65
- "id": {
66
- "type": "string",
67
- "maxLength": 24
68
- },
69
- "stripe_product_id": {
70
- "type": ["string", "null"],
71
- "maxLength": 255
72
- },
73
- "stripe_price_id": {
74
- "type": "string",
75
- "maxLength": 255
76
- },
77
- "nickname": {
78
- "type": "string",
79
- "maxLength": 50
80
- },
81
- "currency": {
82
- "type": "string",
83
- "maxLength": 3
84
- },
85
- "amount": {
86
- "type": "number"
87
- },
88
- "active": {
89
- "type": "boolean",
90
- "default": true
91
- },
92
- "type": {
93
- "type": "string",
94
- "enum": ["recurring", "one_time"]
95
- },
96
- "interval": {
97
- "type": ["string", "null"],
98
- "enum": ["year", "month", "week", "day"]
99
- },
100
- "updated_at": {
101
- "strip": true
102
- },
103
- "created_at": {
104
- "strip": true
105
- }
106
- }
107
- },
108
- "tier-benefit": {
109
- "description": "A Benefit associated with a Tier",
110
- "type": "object",
111
- "properties": {
112
- "id": {
113
- "type": "string",
114
- "maxLength": 24
115
- },
116
- "name": {
117
- "type": "string",
118
- "maxLength": 191
119
- },
120
- "slug": {
121
- "type": "string",
122
- "maxLength": 191
123
- },
124
- "updated_at": {
125
- "strip": true
126
- },
127
- "created_at": {
128
- "strip": true
129
- }
130
- },
131
- "anyOf": [
132
- { "required": ["id"] },
133
- { "required": ["name"] },
134
- { "required": ["slug"] }
135
- ]
136
51
  }
137
52
  }
138
53
  }
@@ -35,36 +35,6 @@
35
35
  "api_version": {
36
36
  "type": ["string", "null"],
37
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
38
  }
69
39
  }
70
40
  }
@@ -33,33 +33,6 @@
33
33
  "integration_id": {
34
34
  "type": ["string", "null"],
35
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
36
  }
64
37
  }
65
38
  }
@@ -1,6 +1,5 @@
1
1
  const _ = require('lodash');
2
2
  const Ajv = require('ajv');
3
- const stripKeyword = require('./strip-keyword');
4
3
  const isLowercaseKeyword = require('./is-lowercase-keyword');
5
4
  const errors = require('@tryghost/errors');
6
5
 
@@ -20,7 +19,6 @@ const ajv = new Ajv({
20
19
  }
21
20
  });
22
21
 
23
- stripKeyword(ajv);
24
22
  isLowercaseKeyword(ajv);
25
23
 
26
24
  const getValidation = (schema, def) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tryghost/admin-api-schema",
3
- "version": "3.2.1",
3
+ "version": "4.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",
@@ -19,14 +19,15 @@
19
19
  "access": "public"
20
20
  },
21
21
  "devDependencies": {
22
- "c8": "7.11.2",
22
+ "c8": "7.11.3",
23
23
  "mocha": "10.0.0",
24
24
  "should": "13.2.3",
25
25
  "sinon": "14.0.0"
26
26
  },
27
27
  "dependencies": {
28
28
  "@tryghost/errors": "^1.0.0",
29
+ "ajv": "^6.12.6",
29
30
  "lodash": "^4.17.11"
30
31
  },
31
- "gitHead": "6f491fe5034408e471a2cf5205eb89380e587255"
32
+ "gitHead": "31e2a37039377b1c785be278a78085cbf0a494f1"
32
33
  }
@@ -1,22 +0,0 @@
1
- /**
2
- * 'strip' keyword is introduced into schemas for following behavior:
3
- * properties that are 'known' but should not be present in the model
4
- * should be stripped from data and not throw validation errors.
5
- *
6
- * An example of such property is `tag.parent` which we want to ignore
7
- * but not necessarily throw a validation error as it was present in
8
- * responses in previous versions of API
9
- */
10
- module.exports = function defFunc(ajv) {
11
- defFunc.definition = {
12
- errors: false,
13
- modifying: true,
14
- valid: true,
15
- validate: function (schema, data, parentSchema, dataPath, parentData, propName) {
16
- delete parentData[propName];
17
- }
18
- };
19
-
20
- ajv.addKeyword('strip', defFunc.definition);
21
- return ajv;
22
- };