json-schema-library 5.2.1 → 6.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.
- package/.prettierignore +1 -0
- package/.prettierrc +7 -0
- package/README.md +9 -8
- package/dist/index.d.ts +13 -44
- package/dist/jsonSchemaLibrary.js +1 -1
- package/dist/lib/addValidator.d.ts +2 -1
- package/dist/lib/compile/index.d.ts +11 -0
- package/dist/lib/config/strings.d.ts +1 -39
- package/dist/lib/cores/CoreInterface.d.ts +28 -9
- package/dist/lib/cores/Draft04.d.ts +2 -2
- package/dist/lib/cores/Draft06.d.ts +15 -0
- package/dist/lib/cores/Draft07.d.ts +15 -0
- package/dist/lib/cores/JsonEditor.d.ts +2 -2
- package/dist/lib/draft06/addSchema.d.ts +7 -0
- package/dist/lib/draft06/compile/index.d.ts +15 -0
- package/dist/lib/draft06/validation/keyword.d.ts +3 -0
- package/dist/lib/draft06/validation/type.d.ts +17 -0
- package/dist/lib/draft06/validation/typeKeywordMapping.d.ts +13 -0
- package/dist/lib/getChildSchemaSelection.d.ts +7 -5
- package/dist/lib/getSchema.d.ts +1 -1
- package/dist/lib/getTemplate.d.ts +5 -1
- package/dist/lib/getTypeOf.d.ts +2 -1
- package/dist/lib/schema/getTypeId.d.ts +1 -1
- package/dist/lib/step.d.ts +4 -4
- package/dist/lib/types.d.ts +10 -2
- package/dist/lib/utils/filter.d.ts +0 -1
- package/dist/lib/utils/merge.d.ts +3 -0
- package/dist/lib/validate.d.ts +1 -1
- package/dist/lib/validation/format.d.ts +6 -0
- package/dist/lib/validation/keyword.d.ts +2 -27
- package/dist/lib/validation/type.d.ts +3 -10
- package/dist/lib/validation/typeKeywordMapping.d.ts +4 -4
- package/dist/module/index.js +13 -6
- package/dist/module/lib/addValidator.js +3 -4
- package/dist/module/lib/compile/getRef.js +1 -1
- package/dist/module/lib/compile/index.js +11 -0
- package/dist/module/lib/config/strings.js +15 -2
- package/dist/module/lib/cores/CoreInterface.js +22 -0
- package/dist/module/lib/cores/Draft06.js +61 -0
- package/dist/module/lib/cores/Draft07.js +61 -0
- package/dist/module/lib/createSchemaOf.js +1 -1
- package/dist/module/lib/draft06/addSchema.js +11 -0
- package/dist/module/lib/draft06/compile/index.js +65 -0
- package/dist/module/lib/draft06/validation/keyword.js +156 -0
- package/dist/module/lib/draft06/validation/type.js +30 -0
- package/dist/module/lib/draft06/validation/typeKeywordMapping.js +15 -0
- package/dist/module/lib/each.js +1 -1
- package/dist/module/lib/eachSchema.js +3 -3
- package/dist/module/lib/getChildSchemaSelection.js +7 -6
- package/dist/module/lib/getSchema.js +2 -1
- package/dist/module/lib/getTemplate.js +57 -23
- package/dist/module/lib/resolveAllOf.js +3 -4
- package/dist/module/lib/resolveOneOf.fuzzy.js +13 -3
- package/dist/module/lib/resolveOneOf.strict.js +11 -2
- package/dist/module/lib/resolveRef.strict.js +8 -0
- package/dist/module/lib/schema/getTypeDefs.js +12 -1
- package/dist/module/lib/schema/getTypeId.js +1 -1
- package/dist/module/lib/step.js +62 -11
- package/dist/module/lib/types.js +7 -1
- package/dist/module/lib/utils/filter.js +3 -5
- package/dist/module/lib/utils/merge.js +3 -0
- package/dist/module/lib/validate.js +33 -8
- package/dist/module/lib/validateAsync.js +7 -7
- package/dist/module/lib/validation/errors.js +15 -2
- package/dist/module/lib/validation/format.js +105 -4
- package/dist/module/lib/validation/keyword.js +77 -30
- package/dist/module/lib/validation/type.js +2 -1
- package/dist/module/remotes/draft06.json +155 -0
- package/dist/module/remotes/draft07.json +172 -0
- package/dist/module/remotes/index.js +0 -1
- package/dist/remotes/index.d.ts +0 -1
- package/index.ts +14 -5
- package/lib/addValidator.ts +5 -5
- package/lib/compile/getRef.ts +1 -1
- package/lib/compile/index.ts +11 -1
- package/lib/config/strings.ts +17 -3
- package/lib/cores/CoreInterface.ts +37 -10
- package/lib/cores/Draft04.ts +2 -4
- package/lib/cores/Draft06.ts +76 -0
- package/lib/cores/Draft07.ts +75 -0
- package/lib/cores/JsonEditor.ts +2 -4
- package/lib/createSchemaOf.ts +1 -3
- package/lib/draft06/addSchema.ts +14 -0
- package/lib/draft06/compile/index.ts +68 -0
- package/lib/draft06/validation/keyword.ts +177 -0
- package/lib/draft06/validation/type.ts +43 -0
- package/lib/draft06/validation/typeKeywordMapping.ts +15 -0
- package/lib/each.ts +8 -3
- package/lib/eachSchema.ts +3 -3
- package/lib/getChildSchemaSelection.ts +14 -7
- package/lib/getSchema.ts +15 -7
- package/lib/getTemplate.ts +148 -38
- package/lib/getTypeOf.ts +2 -1
- package/lib/resolveAllOf.ts +9 -5
- package/lib/resolveOneOf.fuzzy.ts +25 -8
- package/lib/resolveOneOf.strict.ts +17 -4
- package/lib/resolveRef.strict.ts +9 -0
- package/lib/schema/getTypeDefs.ts +14 -1
- package/lib/schema/getTypeId.ts +2 -2
- package/lib/step.ts +103 -22
- package/lib/types.ts +21 -4
- package/lib/utils/filter.ts +4 -6
- package/lib/utils/merge.ts +4 -0
- package/lib/validate.ts +45 -15
- package/lib/validateAsync.ts +13 -12
- package/lib/validation/errors.ts +15 -2
- package/lib/validation/format.ts +113 -4
- package/lib/validation/keyword.ts +147 -78
- package/lib/validation/type.ts +5 -1
- package/package.json +73 -63
- package/remotes/draft06.json +155 -0
- package/remotes/draft07.json +172 -0
- package/remotes/draft2019-09.json +86 -0
- package/remotes/index.ts +0 -2
- package/tsconfig.json +2 -9
|
@@ -2,25 +2,29 @@ import getTypeOf from "../getTypeOf";
|
|
|
2
2
|
import isSame from "../utils/deepCompare";
|
|
3
3
|
import settings from "../config/settings";
|
|
4
4
|
import ucs2decode from "../utils/punycode.ucs2decode";
|
|
5
|
+
import { isJSONError } from "../types";
|
|
5
6
|
const FPP = settings.floatingPointPrecision;
|
|
7
|
+
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
8
|
+
const hasProperty = (value, property) => !(value[property] === undefined || !hasOwnProperty.call(value, property));
|
|
6
9
|
// list of validation keywords: http://json-schema.org/latest/json-schema-validation.html#rfc.section.5
|
|
7
10
|
const KeywordValidation = {
|
|
8
11
|
additionalProperties: (core, schema, value, pointer) => {
|
|
9
12
|
if (schema.additionalProperties === true || schema.additionalProperties == null) {
|
|
10
13
|
return undefined;
|
|
11
14
|
}
|
|
12
|
-
if (getTypeOf(schema.patternProperties) === "object" &&
|
|
15
|
+
if (getTypeOf(schema.patternProperties) === "object" &&
|
|
16
|
+
schema.additionalProperties === false) {
|
|
13
17
|
// this is an arrangement with patternProperties. patternProperties validate before additionalProperties:
|
|
14
18
|
// https://spacetelescope.github.io/understanding-json-schema/reference/object.html#index-5
|
|
15
19
|
return undefined;
|
|
16
20
|
}
|
|
17
21
|
const errors = [];
|
|
18
|
-
let receivedProperties = Object.keys(value).filter(prop => settings.propertyBlacklist.includes(prop) === false);
|
|
22
|
+
let receivedProperties = Object.keys(value).filter((prop) => settings.propertyBlacklist.includes(prop) === false);
|
|
19
23
|
const expectedProperties = Object.keys(schema.properties || {});
|
|
20
24
|
if (getTypeOf(schema.patternProperties) === "object") {
|
|
21
25
|
// filter received properties by matching patternProperties
|
|
22
|
-
const patterns = Object.keys(schema.patternProperties).map(pattern => new RegExp(pattern));
|
|
23
|
-
receivedProperties = receivedProperties.filter(prop => {
|
|
26
|
+
const patterns = Object.keys(schema.patternProperties).map((pattern) => new RegExp(pattern));
|
|
27
|
+
receivedProperties = receivedProperties.filter((prop) => {
|
|
24
28
|
for (let i = 0; i < patterns.length; i += 1) {
|
|
25
29
|
if (patterns[i].test(prop)) {
|
|
26
30
|
return false; // remove
|
|
@@ -37,7 +41,7 @@ const KeywordValidation = {
|
|
|
37
41
|
// additionalProperties { oneOf: [] }
|
|
38
42
|
if (isObject && Array.isArray(schema.additionalProperties.oneOf)) {
|
|
39
43
|
const result = core.resolveOneOf(value[property], schema.additionalProperties, `${pointer}/${property}`);
|
|
40
|
-
if (result
|
|
44
|
+
if (isJSONError(result)) {
|
|
41
45
|
errors.push(core.errors.additionalPropertiesError({
|
|
42
46
|
schema: schema.additionalProperties,
|
|
43
47
|
property: receivedProperties[i],
|
|
@@ -53,7 +57,8 @@ const KeywordValidation = {
|
|
|
53
57
|
// additionalProperties {}
|
|
54
58
|
}
|
|
55
59
|
else if (isObject) {
|
|
56
|
-
if (core.validate(value[property], schema.additionalProperties, pointer)
|
|
60
|
+
if (core.validate(value[property], schema.additionalProperties, pointer)
|
|
61
|
+
.length !== 0) {
|
|
57
62
|
errors.push(core.errors.additionalPropertiesError({
|
|
58
63
|
schema: schema.additionalProperties,
|
|
59
64
|
property: receivedProperties[i],
|
|
@@ -63,7 +68,11 @@ const KeywordValidation = {
|
|
|
63
68
|
}
|
|
64
69
|
}
|
|
65
70
|
else {
|
|
66
|
-
errors.push(core.errors.noAdditionalPropertiesError({
|
|
71
|
+
errors.push(core.errors.noAdditionalPropertiesError({
|
|
72
|
+
property: receivedProperties[i],
|
|
73
|
+
properties: expectedProperties,
|
|
74
|
+
pointer
|
|
75
|
+
}));
|
|
67
76
|
}
|
|
68
77
|
}
|
|
69
78
|
}
|
|
@@ -74,7 +83,7 @@ const KeywordValidation = {
|
|
|
74
83
|
return undefined;
|
|
75
84
|
}
|
|
76
85
|
const errors = [];
|
|
77
|
-
schema.allOf.forEach(subSchema => {
|
|
86
|
+
schema.allOf.forEach((subSchema) => {
|
|
78
87
|
errors.push(core.validate(value, subSchema, pointer));
|
|
79
88
|
});
|
|
80
89
|
return errors;
|
|
@@ -95,17 +104,24 @@ const KeywordValidation = {
|
|
|
95
104
|
return undefined;
|
|
96
105
|
}
|
|
97
106
|
const errors = [];
|
|
98
|
-
Object.keys(value)
|
|
99
|
-
.forEach(property => {
|
|
107
|
+
Object.keys(value).forEach((property) => {
|
|
100
108
|
if (schema.dependencies[property] === undefined) {
|
|
101
109
|
return;
|
|
102
110
|
}
|
|
111
|
+
// @draft >= 6 boolean schema
|
|
112
|
+
if (schema.dependencies[property] === true) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
if (schema.dependencies[property] === false) {
|
|
116
|
+
errors.push(core.errors.missingDependencyError({ pointer }));
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
103
119
|
let dependencyErrors;
|
|
104
120
|
const type = getTypeOf(schema.dependencies[property]);
|
|
105
121
|
if (type === "array") {
|
|
106
122
|
dependencyErrors = schema.dependencies[property]
|
|
107
|
-
.filter(dependency => value[dependency] === undefined)
|
|
108
|
-
.map(missingProperty => core.errors.missingDependencyError({ missingProperty, pointer }));
|
|
123
|
+
.filter((dependency) => value[dependency] === undefined)
|
|
124
|
+
.map((missingProperty) => core.errors.missingDependencyError({ missingProperty, pointer }));
|
|
109
125
|
}
|
|
110
126
|
else if (type === "object") {
|
|
111
127
|
dependencyErrors = core.validate(value, schema.dependencies[property]);
|
|
@@ -117,7 +133,7 @@ const KeywordValidation = {
|
|
|
117
133
|
});
|
|
118
134
|
return errors.length > 0 ? errors : undefined;
|
|
119
135
|
},
|
|
120
|
-
|
|
136
|
+
enum: (core, schema, value, pointer) => {
|
|
121
137
|
const type = getTypeOf(value);
|
|
122
138
|
if (type === "object" || type === "array") {
|
|
123
139
|
const valueStr = JSON.stringify(value);
|
|
@@ -141,12 +157,19 @@ const KeywordValidation = {
|
|
|
141
157
|
return undefined;
|
|
142
158
|
},
|
|
143
159
|
items: (core, schema, value, pointer) => {
|
|
160
|
+
// @draft >= 7 bool schema
|
|
161
|
+
if (schema.items === false) {
|
|
162
|
+
if (Array.isArray(value) && value.length === 0) {
|
|
163
|
+
return undefined;
|
|
164
|
+
}
|
|
165
|
+
return core.errors.invalidDataError({ pointer, value });
|
|
166
|
+
}
|
|
144
167
|
const errors = [];
|
|
145
168
|
for (let i = 0; i < value.length; i += 1) {
|
|
146
169
|
const itemData = value[i];
|
|
147
170
|
// @todo reevaluate: incomplete schema is created here
|
|
148
171
|
const itemSchema = core.step(i, schema, value, pointer);
|
|
149
|
-
if (itemSchema
|
|
172
|
+
if (isJSONError(itemSchema)) {
|
|
150
173
|
return [itemSchema];
|
|
151
174
|
}
|
|
152
175
|
const itemErrors = core.validate(itemData, itemSchema, `${pointer}/${i}`);
|
|
@@ -171,7 +194,11 @@ const KeywordValidation = {
|
|
|
171
194
|
return undefined;
|
|
172
195
|
}
|
|
173
196
|
if (schema.maxItems < value.length) {
|
|
174
|
-
return core.errors.maxItemsError({
|
|
197
|
+
return core.errors.maxItemsError({
|
|
198
|
+
maximum: schema.maxItems,
|
|
199
|
+
length: value.length,
|
|
200
|
+
pointer
|
|
201
|
+
});
|
|
175
202
|
}
|
|
176
203
|
return undefined;
|
|
177
204
|
},
|
|
@@ -181,7 +208,11 @@ const KeywordValidation = {
|
|
|
181
208
|
}
|
|
182
209
|
const lengthOfString = ucs2decode(value).length;
|
|
183
210
|
if (schema.maxLength < lengthOfString) {
|
|
184
|
-
return core.errors.maxLengthError({
|
|
211
|
+
return core.errors.maxLengthError({
|
|
212
|
+
maxLength: schema.maxLength,
|
|
213
|
+
length: lengthOfString,
|
|
214
|
+
pointer
|
|
215
|
+
});
|
|
185
216
|
}
|
|
186
217
|
return undefined;
|
|
187
218
|
},
|
|
@@ -202,7 +233,11 @@ const KeywordValidation = {
|
|
|
202
233
|
}
|
|
203
234
|
const lengthOfString = ucs2decode(value).length;
|
|
204
235
|
if (schema.minLength > lengthOfString) {
|
|
205
|
-
return core.errors.minLengthError({
|
|
236
|
+
return core.errors.minLengthError({
|
|
237
|
+
minLength: schema.minLength,
|
|
238
|
+
length: lengthOfString,
|
|
239
|
+
pointer
|
|
240
|
+
});
|
|
206
241
|
}
|
|
207
242
|
return undefined;
|
|
208
243
|
},
|
|
@@ -223,7 +258,11 @@ const KeywordValidation = {
|
|
|
223
258
|
return undefined;
|
|
224
259
|
}
|
|
225
260
|
if (schema.minItems > value.length) {
|
|
226
|
-
return core.errors.minItemsError({
|
|
261
|
+
return core.errors.minItemsError({
|
|
262
|
+
minItems: schema.minItems,
|
|
263
|
+
length: value.length,
|
|
264
|
+
pointer
|
|
265
|
+
});
|
|
227
266
|
}
|
|
228
267
|
return undefined;
|
|
229
268
|
},
|
|
@@ -235,7 +274,8 @@ const KeywordValidation = {
|
|
|
235
274
|
if (schema.minProperties > propertyCount) {
|
|
236
275
|
return core.errors.minPropertiesError({
|
|
237
276
|
minProperties: schema.minProperties,
|
|
238
|
-
length: propertyCount,
|
|
277
|
+
length: propertyCount,
|
|
278
|
+
pointer
|
|
239
279
|
});
|
|
240
280
|
}
|
|
241
281
|
return undefined;
|
|
@@ -246,9 +286,10 @@ const KeywordValidation = {
|
|
|
246
286
|
}
|
|
247
287
|
// https://github.com/cfworker/cfworker/blob/master/packages/json-schema/src/validate.ts#L1061
|
|
248
288
|
// https://github.com/ExodusMovement/schemasafe/blob/master/src/compile.js#L441
|
|
249
|
-
if ((value * FPP) % (schema.multipleOf * FPP) / FPP !== 0) {
|
|
289
|
+
if (((value * FPP) % (schema.multipleOf * FPP)) / FPP !== 0) {
|
|
250
290
|
return core.errors.multipleOfError({ multipleOf: schema.multipleOf, value, pointer });
|
|
251
291
|
}
|
|
292
|
+
// also check https://stackoverflow.com/questions/1815367/catch-and-compute-overflow-during-multiplication-of-two-large-integers
|
|
252
293
|
return undefined;
|
|
253
294
|
},
|
|
254
295
|
not: (core, schema, value, pointer) => {
|
|
@@ -263,7 +304,7 @@ const KeywordValidation = {
|
|
|
263
304
|
return undefined;
|
|
264
305
|
}
|
|
265
306
|
schema = core.resolveOneOf(value, schema, pointer);
|
|
266
|
-
if (schema
|
|
307
|
+
if (isJSONError(schema)) {
|
|
267
308
|
return schema;
|
|
268
309
|
}
|
|
269
310
|
return undefined;
|
|
@@ -274,7 +315,8 @@ const KeywordValidation = {
|
|
|
274
315
|
return core.errors.patternError({
|
|
275
316
|
pattern: schema.pattern,
|
|
276
317
|
description: schema.patternExample || schema.pattern,
|
|
277
|
-
received: value,
|
|
318
|
+
received: value,
|
|
319
|
+
pointer
|
|
278
320
|
});
|
|
279
321
|
}
|
|
280
322
|
return undefined;
|
|
@@ -287,11 +329,11 @@ const KeywordValidation = {
|
|
|
287
329
|
}
|
|
288
330
|
const errors = [];
|
|
289
331
|
const keys = Object.keys(value);
|
|
290
|
-
const patterns = Object.keys(pp).map(expr => ({
|
|
332
|
+
const patterns = Object.keys(pp).map((expr) => ({
|
|
291
333
|
regex: new RegExp(expr),
|
|
292
334
|
patternSchema: pp[expr]
|
|
293
335
|
}));
|
|
294
|
-
keys.forEach(key => {
|
|
336
|
+
keys.forEach((key) => {
|
|
295
337
|
let patternFound = false;
|
|
296
338
|
for (let i = 0, l = patterns.length; i < l; i += 1) {
|
|
297
339
|
if (patterns[i].regex.test(key)) {
|
|
@@ -308,7 +350,9 @@ const KeywordValidation = {
|
|
|
308
350
|
if (patternFound === false && schema.additionalProperties === false) {
|
|
309
351
|
// this is an arrangement with additionalProperties
|
|
310
352
|
errors.push(core.errors.patternPropertiesError({
|
|
311
|
-
key,
|
|
353
|
+
key,
|
|
354
|
+
pointer,
|
|
355
|
+
patterns: Object.keys(pp).join(",")
|
|
312
356
|
}));
|
|
313
357
|
}
|
|
314
358
|
});
|
|
@@ -319,7 +363,7 @@ const KeywordValidation = {
|
|
|
319
363
|
const keys = Object.keys(schema.properties || {});
|
|
320
364
|
for (let i = 0; i < keys.length; i += 1) {
|
|
321
365
|
const key = keys[i];
|
|
322
|
-
if (value
|
|
366
|
+
if (hasProperty(value, key)) {
|
|
323
367
|
const itemSchema = core.step(key, schema, value, pointer);
|
|
324
368
|
const keyErrors = core.validate(value[key], itemSchema, `${pointer}/${key}`);
|
|
325
369
|
errors.push(...keyErrors);
|
|
@@ -348,8 +392,8 @@ const KeywordValidation = {
|
|
|
348
392
|
if (Array.isArray(schema.required) === false) {
|
|
349
393
|
return undefined;
|
|
350
394
|
}
|
|
351
|
-
return schema.required.map(property => {
|
|
352
|
-
if (value
|
|
395
|
+
return schema.required.map((property) => {
|
|
396
|
+
if (!hasProperty(value, property)) {
|
|
353
397
|
return core.errors.requiredPropertyError({ key: property, pointer });
|
|
354
398
|
}
|
|
355
399
|
return undefined;
|
|
@@ -360,9 +404,12 @@ const KeywordValidation = {
|
|
|
360
404
|
if (Array.isArray(schema.required) === false) {
|
|
361
405
|
return undefined;
|
|
362
406
|
}
|
|
363
|
-
return schema.required.map(property => {
|
|
407
|
+
return schema.required.map((property) => {
|
|
364
408
|
if (value[property] == null || value[property] === "") {
|
|
365
|
-
return core.errors.valueNotEmptyError({
|
|
409
|
+
return core.errors.valueNotEmptyError({
|
|
410
|
+
property,
|
|
411
|
+
pointer: `${pointer}/${property}`
|
|
412
|
+
});
|
|
366
413
|
}
|
|
367
414
|
return undefined;
|
|
368
415
|
});
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* or seven in case of ajv https://github.com/epoberezkin/ajv/blob/master/KEYWORDS.md#type
|
|
6
6
|
* 1 null, 2 boolean, 3 object, 4 array, 5 number, 6 string (7 integer)
|
|
7
7
|
*/
|
|
8
|
-
|
|
8
|
+
const typeValidators = {
|
|
9
9
|
array: (core, schema, value, pointer) => core.typeKeywords.array
|
|
10
10
|
.filter(key => schema && schema[key] != null)
|
|
11
11
|
.map(key => core.validateKeyword[key](core, schema, value, pointer)),
|
|
@@ -28,3 +28,4 @@ export default {
|
|
|
28
28
|
.filter(key => schema && schema[key] != null)
|
|
29
29
|
.map(key => core.validateKeyword[key](core, schema, value, pointer))
|
|
30
30
|
};
|
|
31
|
+
export default typeValidators;
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-06/schema#",
|
|
3
|
+
"$id": "http://json-schema.org/draft-06/schema#",
|
|
4
|
+
"title": "Core schema meta-schema",
|
|
5
|
+
"definitions": {
|
|
6
|
+
"schemaArray": {
|
|
7
|
+
"type": "array",
|
|
8
|
+
"minItems": 1,
|
|
9
|
+
"items": { "$ref": "#" }
|
|
10
|
+
},
|
|
11
|
+
"nonNegativeInteger": {
|
|
12
|
+
"type": "integer",
|
|
13
|
+
"minimum": 0
|
|
14
|
+
},
|
|
15
|
+
"nonNegativeIntegerDefault0": {
|
|
16
|
+
"allOf": [
|
|
17
|
+
{ "$ref": "#/definitions/nonNegativeInteger" },
|
|
18
|
+
{ "default": 0 }
|
|
19
|
+
]
|
|
20
|
+
},
|
|
21
|
+
"simpleTypes": {
|
|
22
|
+
"enum": [
|
|
23
|
+
"array",
|
|
24
|
+
"boolean",
|
|
25
|
+
"integer",
|
|
26
|
+
"null",
|
|
27
|
+
"number",
|
|
28
|
+
"object",
|
|
29
|
+
"string"
|
|
30
|
+
]
|
|
31
|
+
},
|
|
32
|
+
"stringArray": {
|
|
33
|
+
"type": "array",
|
|
34
|
+
"items": { "type": "string" },
|
|
35
|
+
"uniqueItems": true,
|
|
36
|
+
"default": []
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"type": ["object", "boolean"],
|
|
40
|
+
"properties": {
|
|
41
|
+
"$id": {
|
|
42
|
+
"type": "string",
|
|
43
|
+
"format": "uri-reference"
|
|
44
|
+
},
|
|
45
|
+
"$schema": {
|
|
46
|
+
"type": "string",
|
|
47
|
+
"format": "uri"
|
|
48
|
+
},
|
|
49
|
+
"$ref": {
|
|
50
|
+
"type": "string",
|
|
51
|
+
"format": "uri-reference"
|
|
52
|
+
},
|
|
53
|
+
"title": {
|
|
54
|
+
"type": "string"
|
|
55
|
+
},
|
|
56
|
+
"description": {
|
|
57
|
+
"type": "string"
|
|
58
|
+
},
|
|
59
|
+
"default": {},
|
|
60
|
+
"examples": {
|
|
61
|
+
"type": "array",
|
|
62
|
+
"items": {}
|
|
63
|
+
},
|
|
64
|
+
"multipleOf": {
|
|
65
|
+
"type": "number",
|
|
66
|
+
"exclusiveMinimum": 0
|
|
67
|
+
},
|
|
68
|
+
"maximum": {
|
|
69
|
+
"type": "number"
|
|
70
|
+
},
|
|
71
|
+
"exclusiveMaximum": {
|
|
72
|
+
"type": "number"
|
|
73
|
+
},
|
|
74
|
+
"minimum": {
|
|
75
|
+
"type": "number"
|
|
76
|
+
},
|
|
77
|
+
"exclusiveMinimum": {
|
|
78
|
+
"type": "number"
|
|
79
|
+
},
|
|
80
|
+
"maxLength": { "$ref": "#/definitions/nonNegativeInteger" },
|
|
81
|
+
"minLength": { "$ref": "#/definitions/nonNegativeIntegerDefault0" },
|
|
82
|
+
"pattern": {
|
|
83
|
+
"type": "string",
|
|
84
|
+
"format": "regex"
|
|
85
|
+
},
|
|
86
|
+
"additionalItems": { "$ref": "#" },
|
|
87
|
+
"items": {
|
|
88
|
+
"anyOf": [
|
|
89
|
+
{ "$ref": "#" },
|
|
90
|
+
{ "$ref": "#/definitions/schemaArray" }
|
|
91
|
+
],
|
|
92
|
+
"default": {}
|
|
93
|
+
},
|
|
94
|
+
"maxItems": { "$ref": "#/definitions/nonNegativeInteger" },
|
|
95
|
+
"minItems": { "$ref": "#/definitions/nonNegativeIntegerDefault0" },
|
|
96
|
+
"uniqueItems": {
|
|
97
|
+
"type": "boolean",
|
|
98
|
+
"default": false
|
|
99
|
+
},
|
|
100
|
+
"contains": { "$ref": "#" },
|
|
101
|
+
"maxProperties": { "$ref": "#/definitions/nonNegativeInteger" },
|
|
102
|
+
"minProperties": { "$ref": "#/definitions/nonNegativeIntegerDefault0" },
|
|
103
|
+
"required": { "$ref": "#/definitions/stringArray" },
|
|
104
|
+
"additionalProperties": { "$ref": "#" },
|
|
105
|
+
"definitions": {
|
|
106
|
+
"type": "object",
|
|
107
|
+
"additionalProperties": { "$ref": "#" },
|
|
108
|
+
"default": {}
|
|
109
|
+
},
|
|
110
|
+
"properties": {
|
|
111
|
+
"type": "object",
|
|
112
|
+
"additionalProperties": { "$ref": "#" },
|
|
113
|
+
"default": {}
|
|
114
|
+
},
|
|
115
|
+
"patternProperties": {
|
|
116
|
+
"type": "object",
|
|
117
|
+
"additionalProperties": { "$ref": "#" },
|
|
118
|
+
"propertyNames": { "format": "regex" },
|
|
119
|
+
"default": {}
|
|
120
|
+
},
|
|
121
|
+
"dependencies": {
|
|
122
|
+
"type": "object",
|
|
123
|
+
"additionalProperties": {
|
|
124
|
+
"anyOf": [
|
|
125
|
+
{ "$ref": "#" },
|
|
126
|
+
{ "$ref": "#/definitions/stringArray" }
|
|
127
|
+
]
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
"propertyNames": { "$ref": "#" },
|
|
131
|
+
"const": {},
|
|
132
|
+
"enum": {
|
|
133
|
+
"type": "array",
|
|
134
|
+
"minItems": 1,
|
|
135
|
+
"uniqueItems": true
|
|
136
|
+
},
|
|
137
|
+
"type": {
|
|
138
|
+
"anyOf": [
|
|
139
|
+
{ "$ref": "#/definitions/simpleTypes" },
|
|
140
|
+
{
|
|
141
|
+
"type": "array",
|
|
142
|
+
"items": { "$ref": "#/definitions/simpleTypes" },
|
|
143
|
+
"minItems": 1,
|
|
144
|
+
"uniqueItems": true
|
|
145
|
+
}
|
|
146
|
+
]
|
|
147
|
+
},
|
|
148
|
+
"format": { "type": "string" },
|
|
149
|
+
"allOf": { "$ref": "#/definitions/schemaArray" },
|
|
150
|
+
"anyOf": { "$ref": "#/definitions/schemaArray" },
|
|
151
|
+
"oneOf": { "$ref": "#/definitions/schemaArray" },
|
|
152
|
+
"not": { "$ref": "#" }
|
|
153
|
+
},
|
|
154
|
+
"default": {}
|
|
155
|
+
}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"$id": "http://json-schema.org/draft-07/schema#",
|
|
4
|
+
"title": "Core schema meta-schema",
|
|
5
|
+
"definitions": {
|
|
6
|
+
"schemaArray": {
|
|
7
|
+
"type": "array",
|
|
8
|
+
"minItems": 1,
|
|
9
|
+
"items": { "$ref": "#" }
|
|
10
|
+
},
|
|
11
|
+
"nonNegativeInteger": {
|
|
12
|
+
"type": "integer",
|
|
13
|
+
"minimum": 0
|
|
14
|
+
},
|
|
15
|
+
"nonNegativeIntegerDefault0": {
|
|
16
|
+
"allOf": [
|
|
17
|
+
{ "$ref": "#/definitions/nonNegativeInteger" },
|
|
18
|
+
{ "default": 0 }
|
|
19
|
+
]
|
|
20
|
+
},
|
|
21
|
+
"simpleTypes": {
|
|
22
|
+
"enum": [
|
|
23
|
+
"array",
|
|
24
|
+
"boolean",
|
|
25
|
+
"integer",
|
|
26
|
+
"null",
|
|
27
|
+
"number",
|
|
28
|
+
"object",
|
|
29
|
+
"string"
|
|
30
|
+
]
|
|
31
|
+
},
|
|
32
|
+
"stringArray": {
|
|
33
|
+
"type": "array",
|
|
34
|
+
"items": { "type": "string" },
|
|
35
|
+
"uniqueItems": true,
|
|
36
|
+
"default": []
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"type": ["object", "boolean"],
|
|
40
|
+
"properties": {
|
|
41
|
+
"$id": {
|
|
42
|
+
"type": "string",
|
|
43
|
+
"format": "uri-reference"
|
|
44
|
+
},
|
|
45
|
+
"$schema": {
|
|
46
|
+
"type": "string",
|
|
47
|
+
"format": "uri"
|
|
48
|
+
},
|
|
49
|
+
"$ref": {
|
|
50
|
+
"type": "string",
|
|
51
|
+
"format": "uri-reference"
|
|
52
|
+
},
|
|
53
|
+
"$comment": {
|
|
54
|
+
"type": "string"
|
|
55
|
+
},
|
|
56
|
+
"title": {
|
|
57
|
+
"type": "string"
|
|
58
|
+
},
|
|
59
|
+
"description": {
|
|
60
|
+
"type": "string"
|
|
61
|
+
},
|
|
62
|
+
"default": true,
|
|
63
|
+
"readOnly": {
|
|
64
|
+
"type": "boolean",
|
|
65
|
+
"default": false
|
|
66
|
+
},
|
|
67
|
+
"writeOnly": {
|
|
68
|
+
"type": "boolean",
|
|
69
|
+
"default": false
|
|
70
|
+
},
|
|
71
|
+
"examples": {
|
|
72
|
+
"type": "array",
|
|
73
|
+
"items": true
|
|
74
|
+
},
|
|
75
|
+
"multipleOf": {
|
|
76
|
+
"type": "number",
|
|
77
|
+
"exclusiveMinimum": 0
|
|
78
|
+
},
|
|
79
|
+
"maximum": {
|
|
80
|
+
"type": "number"
|
|
81
|
+
},
|
|
82
|
+
"exclusiveMaximum": {
|
|
83
|
+
"type": "number"
|
|
84
|
+
},
|
|
85
|
+
"minimum": {
|
|
86
|
+
"type": "number"
|
|
87
|
+
},
|
|
88
|
+
"exclusiveMinimum": {
|
|
89
|
+
"type": "number"
|
|
90
|
+
},
|
|
91
|
+
"maxLength": { "$ref": "#/definitions/nonNegativeInteger" },
|
|
92
|
+
"minLength": { "$ref": "#/definitions/nonNegativeIntegerDefault0" },
|
|
93
|
+
"pattern": {
|
|
94
|
+
"type": "string",
|
|
95
|
+
"format": "regex"
|
|
96
|
+
},
|
|
97
|
+
"additionalItems": { "$ref": "#" },
|
|
98
|
+
"items": {
|
|
99
|
+
"anyOf": [
|
|
100
|
+
{ "$ref": "#" },
|
|
101
|
+
{ "$ref": "#/definitions/schemaArray" }
|
|
102
|
+
],
|
|
103
|
+
"default": true
|
|
104
|
+
},
|
|
105
|
+
"maxItems": { "$ref": "#/definitions/nonNegativeInteger" },
|
|
106
|
+
"minItems": { "$ref": "#/definitions/nonNegativeIntegerDefault0" },
|
|
107
|
+
"uniqueItems": {
|
|
108
|
+
"type": "boolean",
|
|
109
|
+
"default": false
|
|
110
|
+
},
|
|
111
|
+
"contains": { "$ref": "#" },
|
|
112
|
+
"maxProperties": { "$ref": "#/definitions/nonNegativeInteger" },
|
|
113
|
+
"minProperties": { "$ref": "#/definitions/nonNegativeIntegerDefault0" },
|
|
114
|
+
"required": { "$ref": "#/definitions/stringArray" },
|
|
115
|
+
"additionalProperties": { "$ref": "#" },
|
|
116
|
+
"definitions": {
|
|
117
|
+
"type": "object",
|
|
118
|
+
"additionalProperties": { "$ref": "#" },
|
|
119
|
+
"default": {}
|
|
120
|
+
},
|
|
121
|
+
"properties": {
|
|
122
|
+
"type": "object",
|
|
123
|
+
"additionalProperties": { "$ref": "#" },
|
|
124
|
+
"default": {}
|
|
125
|
+
},
|
|
126
|
+
"patternProperties": {
|
|
127
|
+
"type": "object",
|
|
128
|
+
"additionalProperties": { "$ref": "#" },
|
|
129
|
+
"propertyNames": { "format": "regex" },
|
|
130
|
+
"default": {}
|
|
131
|
+
},
|
|
132
|
+
"dependencies": {
|
|
133
|
+
"type": "object",
|
|
134
|
+
"additionalProperties": {
|
|
135
|
+
"anyOf": [
|
|
136
|
+
{ "$ref": "#" },
|
|
137
|
+
{ "$ref": "#/definitions/stringArray" }
|
|
138
|
+
]
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
"propertyNames": { "$ref": "#" },
|
|
142
|
+
"const": true,
|
|
143
|
+
"enum": {
|
|
144
|
+
"type": "array",
|
|
145
|
+
"items": true,
|
|
146
|
+
"minItems": 1,
|
|
147
|
+
"uniqueItems": true
|
|
148
|
+
},
|
|
149
|
+
"type": {
|
|
150
|
+
"anyOf": [
|
|
151
|
+
{ "$ref": "#/definitions/simpleTypes" },
|
|
152
|
+
{
|
|
153
|
+
"type": "array",
|
|
154
|
+
"items": { "$ref": "#/definitions/simpleTypes" },
|
|
155
|
+
"minItems": 1,
|
|
156
|
+
"uniqueItems": true
|
|
157
|
+
}
|
|
158
|
+
]
|
|
159
|
+
},
|
|
160
|
+
"format": { "type": "string" },
|
|
161
|
+
"contentMediaType": { "type": "string" },
|
|
162
|
+
"contentEncoding": { "type": "string" },
|
|
163
|
+
"if": { "$ref": "#" },
|
|
164
|
+
"then": { "$ref": "#" },
|
|
165
|
+
"else": { "$ref": "#" },
|
|
166
|
+
"allOf": { "$ref": "#/definitions/schemaArray" },
|
|
167
|
+
"anyOf": { "$ref": "#/definitions/schemaArray" },
|
|
168
|
+
"oneOf": { "$ref": "#/definitions/schemaArray" },
|
|
169
|
+
"not": { "$ref": "#" }
|
|
170
|
+
},
|
|
171
|
+
"default": true
|
|
172
|
+
}
|