z-schema 12.0.4 → 12.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/bin/z-schema +7 -2
- package/cjs/index.d.ts +541 -530
- package/cjs/index.js +3963 -7740
- package/dist/errors.d.mts +64 -0
- package/dist/errors.mjs +67 -0
- package/dist/format-validators.d.mts +14 -0
- package/dist/format-validators.mjs +261 -0
- package/dist/index.d.mts +10 -0
- package/dist/index.mjs +7 -0
- package/dist/json-schema-versions.d.mts +137 -0
- package/dist/json-schema-versions.mjs +11 -0
- package/dist/json-schema.d.mts +61 -0
- package/dist/json-schema.mjs +53 -0
- package/dist/json-validation.mjs +441 -0
- package/dist/report.d.mts +97 -0
- package/dist/report.mjs +194 -0
- package/dist/schema-cache.d.mts +23 -0
- package/dist/schema-cache.mjs +144 -0
- package/dist/schema-compiler.d.mts +23 -0
- package/dist/schema-compiler.mjs +265 -0
- package/dist/schema-validator.d.mts +15 -0
- package/dist/schema-validator.mjs +446 -0
- package/dist/schemas/draft-04-schema.mjs +125 -0
- package/dist/schemas/draft-06-schema.mjs +126 -0
- package/dist/schemas/draft-07-schema.mjs +141 -0
- package/dist/schemas/draft-2019-09-meta-applicator.mjs +46 -0
- package/dist/schemas/draft-2019-09-meta-content.mjs +15 -0
- package/dist/schemas/draft-2019-09-meta-core.mjs +52 -0
- package/dist/schemas/draft-2019-09-meta-format.mjs +11 -0
- package/dist/schemas/draft-2019-09-meta-meta-data.mjs +31 -0
- package/dist/schemas/draft-2019-09-meta-validation.mjs +80 -0
- package/dist/schemas/draft-2019-09-schema.mjs +39 -0
- package/dist/schemas/draft-2020-12-meta-applicator.mjs +45 -0
- package/dist/schemas/draft-2020-12-meta-content.mjs +15 -0
- package/dist/schemas/draft-2020-12-meta-core.mjs +46 -0
- package/dist/schemas/draft-2020-12-meta-format-annotation.mjs +11 -0
- package/dist/schemas/draft-2020-12-meta-format-assertion.mjs +11 -0
- package/dist/schemas/draft-2020-12-meta-meta-data.mjs +31 -0
- package/dist/schemas/draft-2020-12-meta-unevaluated.mjs +14 -0
- package/dist/schemas/draft-2020-12-meta-validation.mjs +80 -0
- package/dist/schemas/draft-2020-12-schema.mjs +55 -0
- package/dist/utils/array.mjs +54 -0
- package/dist/utils/base64.mjs +21 -0
- package/dist/utils/clone.mjs +42 -0
- package/dist/utils/constants.mjs +16 -0
- package/dist/utils/date.mjs +19 -0
- package/dist/utils/hostname.mjs +73 -0
- package/dist/utils/json.mjs +34 -0
- package/dist/utils/properties.mjs +11 -0
- package/dist/utils/schema-regex.mjs +49 -0
- package/dist/utils/symbols.mjs +5 -0
- package/dist/utils/time.mjs +42 -0
- package/dist/utils/unicode.mjs +12 -0
- package/dist/utils/uri.mjs +12 -0
- package/dist/utils/what-is.mjs +23 -0
- package/dist/validation/array.mjs +57 -0
- package/dist/validation/combinators.mjs +62 -0
- package/dist/validation/numeric.mjs +38 -0
- package/dist/validation/object.mjs +109 -0
- package/dist/validation/ref.mjs +49 -0
- package/dist/validation/shared.mjs +97 -0
- package/dist/validation/string.mjs +88 -0
- package/dist/validation/type.mjs +32 -0
- package/dist/z-schema-base.d.mts +85 -0
- package/dist/z-schema-base.mjs +230 -0
- package/dist/z-schema-options.d.mts +35 -0
- package/dist/z-schema-options.mjs +55 -0
- package/dist/z-schema-reader.d.mts +6 -0
- package/dist/z-schema-reader.mjs +10 -0
- package/dist/z-schema-versions.mjs +67 -0
- package/dist/z-schema.d.mts +193 -0
- package/dist/z-schema.mjs +300 -0
- package/package.json +49 -64
- package/src/index.ts +3 -3
- package/src/schema-compiler.ts +30 -10
- package/src/schema-validator.ts +1 -1
- package/src/utils/schema-regex.ts +13 -2
- package/src/z-schema-base.ts +1 -1
- package/src/z-schema-versions.ts +1 -2
- package/src/z-schema.ts +0 -1
- package/umd/ZSchema.js +5934 -8110
- package/umd/ZSchema.min.js +2 -1
- package/dist/errors.js +0 -72
- package/dist/format-validators.js +0 -392
- package/dist/index.js +0 -5
- package/dist/json-schema-versions.js +0 -8
- package/dist/json-schema.js +0 -84
- package/dist/json-validation.js +0 -728
- package/dist/package.json +0 -3
- package/dist/report.js +0 -265
- package/dist/schema-cache.js +0 -211
- package/dist/schema-compiler.js +0 -415
- package/dist/schema-validator.js +0 -721
- package/dist/schemas/draft-04-schema.json +0 -149
- package/dist/schemas/draft-06-schema.json +0 -155
- package/dist/schemas/draft-07-schema.json +0 -172
- package/dist/schemas/draft-2019-09-meta-applicator.json +0 -52
- package/dist/schemas/draft-2019-09-meta-content.json +0 -12
- package/dist/schemas/draft-2019-09-meta-core.json +0 -53
- package/dist/schemas/draft-2019-09-meta-format.json +0 -10
- package/dist/schemas/draft-2019-09-meta-meta-data.json +0 -32
- package/dist/schemas/draft-2019-09-meta-validation.json +0 -94
- package/dist/schemas/draft-2019-09-schema.json +0 -41
- package/dist/schemas/draft-2020-12-meta-applicator.json +0 -44
- package/dist/schemas/draft-2020-12-meta-content.json +0 -12
- package/dist/schemas/draft-2020-12-meta-core.json +0 -47
- package/dist/schemas/draft-2020-12-meta-format-annotation.json +0 -10
- package/dist/schemas/draft-2020-12-meta-format-assertion.json +0 -10
- package/dist/schemas/draft-2020-12-meta-meta-data.json +0 -32
- package/dist/schemas/draft-2020-12-meta-unevaluated.json +0 -11
- package/dist/schemas/draft-2020-12-meta-validation.json +0 -94
- package/dist/schemas/draft-2020-12-schema.json +0 -57
- package/dist/types/errors.d.ts +0 -64
- package/dist/types/format-validators.d.ts +0 -11
- package/dist/types/index.d.ts +0 -14
- package/dist/types/json-schema-versions.d.ts +0 -142
- package/dist/types/json-schema.d.ts +0 -66
- package/dist/types/json-validation.d.ts +0 -6
- package/dist/types/report.d.ts +0 -94
- package/dist/types/schema-cache.d.ts +0 -27
- package/dist/types/schema-compiler.d.ts +0 -31
- package/dist/types/schema-validator.d.ts +0 -10
- package/dist/types/utils/array.d.ts +0 -9
- package/dist/types/utils/base64.d.ts +0 -2
- package/dist/types/utils/clone.d.ts +0 -2
- package/dist/types/utils/constants.d.ts +0 -19
- package/dist/types/utils/date.d.ts +0 -1
- package/dist/types/utils/hostname.d.ts +0 -2
- package/dist/types/utils/json.d.ts +0 -9
- package/dist/types/utils/properties.d.ts +0 -1
- package/dist/types/utils/schema-regex.d.ts +0 -10
- package/dist/types/utils/symbols.d.ts +0 -2
- package/dist/types/utils/time.d.ts +0 -12
- package/dist/types/utils/unicode.d.ts +0 -5
- package/dist/types/utils/uri.d.ts +0 -4
- package/dist/types/utils/what-is.d.ts +0 -4
- package/dist/types/validation/array.d.ts +0 -12
- package/dist/types/validation/combinators.d.ts +0 -10
- package/dist/types/validation/numeric.d.ts +0 -8
- package/dist/types/validation/object.d.ts +0 -13
- package/dist/types/validation/ref.d.ts +0 -11
- package/dist/types/validation/shared.d.ts +0 -26
- package/dist/types/validation/string.d.ts +0 -9
- package/dist/types/validation/type.d.ts +0 -6
- package/dist/types/z-schema-base.d.ts +0 -87
- package/dist/types/z-schema-options.d.ts +0 -35
- package/dist/types/z-schema-reader.d.ts +0 -4
- package/dist/types/z-schema-versions.d.ts +0 -1
- package/dist/types/z-schema.d.ts +0 -191
- package/dist/utils/array.js +0 -69
- package/dist/utils/base64.js +0 -29
- package/dist/utils/clone.js +0 -59
- package/dist/utils/constants.js +0 -19
- package/dist/utils/date.js +0 -21
- package/dist/utils/hostname.js +0 -146
- package/dist/utils/json.js +0 -70
- package/dist/utils/properties.js +0 -10
- package/dist/utils/schema-regex.js +0 -52
- package/dist/utils/symbols.js +0 -2
- package/dist/utils/time.js +0 -50
- package/dist/utils/unicode.js +0 -12
- package/dist/utils/uri.js +0 -15
- package/dist/utils/what-is.js +0 -32
- package/dist/validation/array.js +0 -127
- package/dist/validation/combinators.js +0 -106
- package/dist/validation/numeric.js +0 -97
- package/dist/validation/object.js +0 -237
- package/dist/validation/ref.js +0 -70
- package/dist/validation/shared.js +0 -136
- package/dist/validation/string.js +0 -170
- package/dist/validation/type.js +0 -55
- package/dist/z-schema-base.js +0 -286
- package/dist/z-schema-options.js +0 -99
- package/dist/z-schema-reader.js +0 -7
- package/dist/z-schema-versions.js +0 -110
- package/dist/z-schema.js +0 -287
|
@@ -0,0 +1,446 @@
|
|
|
1
|
+
import { isInteger, isObject } from "./utils/what-is.mjs";
|
|
2
|
+
import { getId } from "./json-schema.mjs";
|
|
3
|
+
import { shallowClone } from "./utils/clone.mjs";
|
|
4
|
+
import { Report } from "./report.mjs";
|
|
5
|
+
import { isFormatSupported } from "./format-validators.mjs";
|
|
6
|
+
import { compileSchemaRegex } from "./utils/schema-regex.mjs";
|
|
7
|
+
import { isUniqueArray } from "./utils/array.mjs";
|
|
8
|
+
import { validate } from "./json-validation.mjs";
|
|
9
|
+
//#region src/schema-validator.ts
|
|
10
|
+
const SchemaValidators = {
|
|
11
|
+
$ref: function(report, schema) {
|
|
12
|
+
if (typeof schema.$ref !== "string") report.addError("KEYWORD_TYPE_EXPECTED", ["$ref", "string"], void 0, schema, "$ref");
|
|
13
|
+
},
|
|
14
|
+
$schema: function(report, schema) {
|
|
15
|
+
if (typeof schema.$schema !== "string") report.addError("KEYWORD_TYPE_EXPECTED", ["$schema", "string"], void 0, schema, "$schema");
|
|
16
|
+
},
|
|
17
|
+
multipleOf: function(report, schema) {
|
|
18
|
+
if (typeof schema.multipleOf !== "number") report.addError("KEYWORD_TYPE_EXPECTED", ["multipleOf", "number"], void 0, schema, "multipleOf");
|
|
19
|
+
else if (schema.multipleOf <= 0) report.addError("KEYWORD_MUST_BE", ["multipleOf", "strictly greater than 0"], void 0, schema, "multipleOf");
|
|
20
|
+
},
|
|
21
|
+
maximum: function(report, schema) {
|
|
22
|
+
if (typeof schema.maximum !== "number") report.addError("KEYWORD_TYPE_EXPECTED", ["maximum", "number"], void 0, schema, "maximum");
|
|
23
|
+
},
|
|
24
|
+
exclusiveMaximum: function(report, schema) {
|
|
25
|
+
if (report.options.version === "draft-04") {
|
|
26
|
+
if (typeof schema.exclusiveMaximum !== "boolean") report.addError("KEYWORD_TYPE_EXPECTED", ["exclusiveMaximum", "boolean"], void 0, schema, "exclusiveMaximum");
|
|
27
|
+
else if (schema.maximum === void 0) report.addError("KEYWORD_DEPENDENCY", ["exclusiveMaximum", "maximum"], void 0, schema, "exclusiveMaximum");
|
|
28
|
+
} else if (typeof schema.exclusiveMaximum !== "boolean" && typeof schema.exclusiveMaximum !== "number") report.addError("KEYWORD_TYPE_EXPECTED", ["exclusiveMaximum", ["boolean", "number"]], void 0, schema, "exclusiveMaximum");
|
|
29
|
+
},
|
|
30
|
+
minimum: function(report, schema) {
|
|
31
|
+
if (typeof schema.minimum !== "number") report.addError("KEYWORD_TYPE_EXPECTED", ["minimum", "number"], void 0, schema, "minimum");
|
|
32
|
+
},
|
|
33
|
+
exclusiveMinimum: function(report, schema) {
|
|
34
|
+
if (report.options.version === "draft-04") {
|
|
35
|
+
if (typeof schema.exclusiveMinimum !== "boolean") report.addError("KEYWORD_TYPE_EXPECTED", ["exclusiveMinimum", "boolean"], void 0, schema, "exclusiveMinimum");
|
|
36
|
+
else if (schema.minimum === void 0) report.addError("KEYWORD_DEPENDENCY", ["exclusiveMinimum", "minimum"], void 0, schema, "exclusiveMinimum");
|
|
37
|
+
} else if (typeof schema.exclusiveMinimum !== "boolean" && typeof schema.exclusiveMinimum !== "number") report.addError("KEYWORD_TYPE_EXPECTED", ["exclusiveMinimum", ["boolean", "number"]], void 0, schema, "exclusiveMinimum");
|
|
38
|
+
},
|
|
39
|
+
maxLength: function(report, schema) {
|
|
40
|
+
if (!isInteger(schema.maxLength)) report.addError("KEYWORD_TYPE_EXPECTED", ["maxLength", "integer"], void 0, schema, "maxLength");
|
|
41
|
+
else if (schema.maxLength < 0) report.addError("KEYWORD_MUST_BE", ["maxLength", "greater than, or equal to 0"], void 0, schema, "maxLength");
|
|
42
|
+
},
|
|
43
|
+
minLength: function(report, schema) {
|
|
44
|
+
if (!isInteger(schema.minLength)) report.addError("KEYWORD_TYPE_EXPECTED", ["minLength", "integer"], void 0, schema, "minLength");
|
|
45
|
+
else if (schema.minLength < 0) report.addError("KEYWORD_MUST_BE", ["minLength", "greater than, or equal to 0"], void 0, schema, "minLength");
|
|
46
|
+
},
|
|
47
|
+
pattern: function(report, schema) {
|
|
48
|
+
if (typeof schema.pattern !== "string") report.addError("KEYWORD_TYPE_EXPECTED", ["pattern", "string"], void 0, schema, "pattern");
|
|
49
|
+
else {
|
|
50
|
+
const result = compileSchemaRegex(schema.pattern);
|
|
51
|
+
if (!result.ok) report.addError("KEYWORD_PATTERN", [
|
|
52
|
+
"pattern",
|
|
53
|
+
schema.pattern,
|
|
54
|
+
result.error.message
|
|
55
|
+
], void 0, schema, "pattern");
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
additionalItems: function(report, schema) {
|
|
59
|
+
if (typeof schema.additionalItems !== "boolean" && !isObject(schema.additionalItems)) report.addError("KEYWORD_TYPE_EXPECTED", ["additionalItems", ["boolean", "object"]], void 0, schema, "additionalItems");
|
|
60
|
+
else if (isObject(schema.additionalItems)) {
|
|
61
|
+
report.path.push("additionalItems");
|
|
62
|
+
this.validateSchema(report, schema.additionalItems);
|
|
63
|
+
report.path.pop();
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
items: function(report, schema) {
|
|
67
|
+
if (Array.isArray(schema.items)) for (let idx = 0; idx < schema.items.length; idx++) {
|
|
68
|
+
report.path.push("items");
|
|
69
|
+
report.path.push(idx);
|
|
70
|
+
this.validateSchema(report, schema.items[idx]);
|
|
71
|
+
report.path.pop();
|
|
72
|
+
report.path.pop();
|
|
73
|
+
}
|
|
74
|
+
else if (isObject(schema.items) || report.options.version !== "draft-04" && typeof schema.items === "boolean") {
|
|
75
|
+
report.path.push("items");
|
|
76
|
+
this.validateSchema(report, schema.items);
|
|
77
|
+
report.path.pop();
|
|
78
|
+
} else report.addError("KEYWORD_TYPE_EXPECTED", ["items", report.options.version === "draft-04" ? ["array", "object"] : [
|
|
79
|
+
"array",
|
|
80
|
+
"object",
|
|
81
|
+
"boolean"
|
|
82
|
+
]], void 0, schema, "items");
|
|
83
|
+
if (this.options.forceAdditional === true && schema.additionalItems === void 0 && Array.isArray(schema.items)) report.addError("KEYWORD_UNDEFINED_STRICT", ["additionalItems"], void 0, schema, "additionalItems");
|
|
84
|
+
if (this.options.assumeAdditional && schema.additionalItems === void 0 && Array.isArray(schema.items)) schema.additionalItems = false;
|
|
85
|
+
},
|
|
86
|
+
maxItems: function(report, schema) {
|
|
87
|
+
if (typeof schema.maxItems !== "number") report.addError("KEYWORD_TYPE_EXPECTED", ["maxItems", "integer"], void 0, schema, "maxItems");
|
|
88
|
+
else if (schema.maxItems < 0) report.addError("KEYWORD_MUST_BE", ["maxItems", "greater than, or equal to 0"], void 0, schema, "maxItems");
|
|
89
|
+
},
|
|
90
|
+
minItems: function(report, schema) {
|
|
91
|
+
if (!isInteger(schema.minItems)) report.addError("KEYWORD_TYPE_EXPECTED", ["minItems", "integer"], void 0, schema, "minItems");
|
|
92
|
+
else if (schema.minItems < 0) report.addError("KEYWORD_MUST_BE", ["minItems", "greater than, or equal to 0"], void 0, schema, "minItems");
|
|
93
|
+
},
|
|
94
|
+
uniqueItems: function(report, schema) {
|
|
95
|
+
if (typeof schema.uniqueItems !== "boolean") report.addError("KEYWORD_TYPE_EXPECTED", ["uniqueItems", "boolean"], void 0, schema, "uniqueItems");
|
|
96
|
+
},
|
|
97
|
+
maxProperties: function(report, schema) {
|
|
98
|
+
if (!isInteger(schema.maxProperties)) report.addError("KEYWORD_TYPE_EXPECTED", ["maxProperties", "integer"], void 0, schema, "maxProperties");
|
|
99
|
+
else if (schema.maxProperties < 0) report.addError("KEYWORD_MUST_BE", ["maxProperties", "greater than, or equal to 0"], void 0, schema, "maxProperties");
|
|
100
|
+
},
|
|
101
|
+
minProperties: function(report, schema) {
|
|
102
|
+
if (!isInteger(schema.minProperties)) report.addError("KEYWORD_TYPE_EXPECTED", ["minProperties", "integer"], void 0, schema, "minProperties");
|
|
103
|
+
else if (schema.minProperties < 0) report.addError("KEYWORD_MUST_BE", ["minProperties", "greater than, or equal to 0"], void 0, schema, "minProperties");
|
|
104
|
+
},
|
|
105
|
+
required: function(report, schema) {
|
|
106
|
+
if (!Array.isArray(schema.required)) report.addError("KEYWORD_TYPE_EXPECTED", ["required", "array"], void 0, schema, "required");
|
|
107
|
+
else if (report.options.version === "draft-04" && schema.required.length === 0) report.addError("KEYWORD_MUST_BE", ["required", "an array with at least one element"], void 0, schema, "required");
|
|
108
|
+
else {
|
|
109
|
+
for (const item of schema.required) if (typeof item !== "string") report.addError("KEYWORD_VALUE_TYPE", ["required", "string"], void 0, schema, "required");
|
|
110
|
+
if (isUniqueArray(schema.required) === false) report.addError("KEYWORD_MUST_BE", ["required", "an array with unique items"], void 0, schema, "required");
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
additionalProperties: function(report, schema) {
|
|
114
|
+
if (typeof schema.additionalProperties !== "boolean" && !isObject(schema.additionalProperties)) report.addError("KEYWORD_TYPE_EXPECTED", ["additionalProperties", ["boolean", "object"]], void 0, schema, "additionalProperties");
|
|
115
|
+
else if (isObject(schema.additionalProperties)) {
|
|
116
|
+
report.path.push("additionalProperties");
|
|
117
|
+
this.validateSchema(report, schema.additionalProperties);
|
|
118
|
+
report.path.pop();
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
properties: function(report, schema) {
|
|
122
|
+
if (!isObject(schema.properties)) {
|
|
123
|
+
report.addError("KEYWORD_TYPE_EXPECTED", ["properties", "object"], void 0, schema, "properties");
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
const keys = Object.keys(schema.properties);
|
|
127
|
+
for (const key of keys) {
|
|
128
|
+
const val = schema.properties[key];
|
|
129
|
+
report.path.push("properties");
|
|
130
|
+
report.path.push(key);
|
|
131
|
+
this.validateSchema(report, val);
|
|
132
|
+
report.path.pop();
|
|
133
|
+
report.path.pop();
|
|
134
|
+
}
|
|
135
|
+
if (this.options.forceAdditional === true && schema.additionalProperties === void 0) report.addError("KEYWORD_UNDEFINED_STRICT", ["additionalProperties"], void 0, schema, "additionalProperties");
|
|
136
|
+
if (this.options.assumeAdditional && schema.additionalProperties === void 0) schema.additionalProperties = false;
|
|
137
|
+
if (this.options.forceProperties === true && keys.length === 0) report.addError("CUSTOM_MODE_FORCE_PROPERTIES", ["properties"], void 0, schema, "properties");
|
|
138
|
+
},
|
|
139
|
+
patternProperties: function(report, schema) {
|
|
140
|
+
if (!isObject(schema.patternProperties)) {
|
|
141
|
+
report.addError("KEYWORD_TYPE_EXPECTED", ["patternProperties", "object"], void 0, schema, "patternProperties");
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
const keys = Object.keys(schema.patternProperties);
|
|
145
|
+
for (const key of keys) {
|
|
146
|
+
const val = schema.patternProperties[key];
|
|
147
|
+
const result = compileSchemaRegex(key);
|
|
148
|
+
if (!result.ok) report.addError("KEYWORD_PATTERN", [
|
|
149
|
+
"patternProperties",
|
|
150
|
+
key,
|
|
151
|
+
result.error.message
|
|
152
|
+
], void 0, schema, "patternProperties");
|
|
153
|
+
report.path.push("patternProperties");
|
|
154
|
+
report.path.push(key);
|
|
155
|
+
this.validateSchema(report, val);
|
|
156
|
+
report.path.pop();
|
|
157
|
+
report.path.pop();
|
|
158
|
+
}
|
|
159
|
+
if (this.options.forceProperties === true && keys.length === 0) report.addError("CUSTOM_MODE_FORCE_PROPERTIES", ["patternProperties"], void 0, schema, "patternProperties");
|
|
160
|
+
},
|
|
161
|
+
dependencies: function(report, schema) {
|
|
162
|
+
if (!isObject(schema.dependencies)) report.addError("KEYWORD_TYPE_EXPECTED", ["dependencies", "object"], void 0, schema, "dependencies");
|
|
163
|
+
else {
|
|
164
|
+
const keys = Object.keys(schema.dependencies);
|
|
165
|
+
for (const schemaKey of keys) {
|
|
166
|
+
const schemaDependency = schema.dependencies[schemaKey];
|
|
167
|
+
if (isObject(schemaDependency) || report.options.version !== "draft-04" && typeof schemaDependency === "boolean") {
|
|
168
|
+
report.path.push("dependencies");
|
|
169
|
+
report.path.push(schemaKey);
|
|
170
|
+
this.validateSchema(report, schemaDependency);
|
|
171
|
+
report.path.pop();
|
|
172
|
+
report.path.pop();
|
|
173
|
+
} else if (Array.isArray(schemaDependency)) {
|
|
174
|
+
const depArray = schemaDependency;
|
|
175
|
+
if (report.options.version === "draft-04" && depArray.length === 0) report.addError("KEYWORD_MUST_BE", ["dependencies", "not empty array"], void 0, schema, "dependencies");
|
|
176
|
+
for (const dep of depArray) if (typeof dep !== "string") report.addError("KEYWORD_VALUE_TYPE", ["dependencies", "string"], void 0, schema, "dependencies");
|
|
177
|
+
if (isUniqueArray(depArray) === false) report.addError("KEYWORD_MUST_BE", ["dependencies", "an array with unique items"], void 0, schema, "dependencies");
|
|
178
|
+
} else report.addError("KEYWORD_VALUE_TYPE", ["dependencies", report.options.version === "draft-04" ? "object or array" : "boolean, object or array"], void 0, schema, "dependencies");
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
enum: function(report, schema) {
|
|
183
|
+
if (Array.isArray(schema.enum) === false) report.addError("KEYWORD_TYPE_EXPECTED", ["enum", "array"], void 0, schema, "enum");
|
|
184
|
+
else if (schema.enum.length === 0) report.addError("KEYWORD_MUST_BE", ["enum", "an array with at least one element"], void 0, schema, "enum");
|
|
185
|
+
else if (isUniqueArray(schema.enum) === false) report.addError("KEYWORD_MUST_BE", ["enum", "an array with unique elements"], void 0, schema, "enum");
|
|
186
|
+
},
|
|
187
|
+
type: function(report, schema) {
|
|
188
|
+
const primitiveTypes = [
|
|
189
|
+
"array",
|
|
190
|
+
"boolean",
|
|
191
|
+
"integer",
|
|
192
|
+
"number",
|
|
193
|
+
"null",
|
|
194
|
+
"object",
|
|
195
|
+
"string"
|
|
196
|
+
];
|
|
197
|
+
const primitiveTypeStr = primitiveTypes.join(",");
|
|
198
|
+
const isArray = Array.isArray(schema.type);
|
|
199
|
+
if (Array.isArray(schema.type)) {
|
|
200
|
+
for (const typeItem of schema.type) if (!primitiveTypes.includes(typeItem)) report.addError("KEYWORD_TYPE_EXPECTED", ["type", primitiveTypeStr], void 0, schema, "type");
|
|
201
|
+
if (isUniqueArray(schema.type) === false) report.addError("KEYWORD_MUST_BE", ["type", "an object with unique properties"], void 0, schema, "type");
|
|
202
|
+
} else if (typeof schema.type === "string") {
|
|
203
|
+
if (!primitiveTypes.includes(schema.type)) report.addError("KEYWORD_TYPE_EXPECTED", ["type", primitiveTypeStr], void 0, schema, "type");
|
|
204
|
+
} else report.addError("KEYWORD_TYPE_EXPECTED", ["type", ["string", "array"]], void 0, schema, "type");
|
|
205
|
+
if (this.options.noEmptyStrings === true) {
|
|
206
|
+
if (schema.type === "string" || isArray && schema.type.includes("string")) {
|
|
207
|
+
if (schema.minLength === void 0 && schema.enum === void 0 && schema.format === void 0) schema.minLength = 1;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
if (this.options.noEmptyArrays === true) {
|
|
211
|
+
if (schema.type === "array" || isArray && schema.type.includes("array")) {
|
|
212
|
+
if (schema.minItems === void 0) schema.minItems = 1;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
if (this.options.forceProperties === true) {
|
|
216
|
+
if (schema.type === "object" || isArray && schema.type.includes("object")) {
|
|
217
|
+
if (schema.properties === void 0 && schema.patternProperties === void 0) report.addError("KEYWORD_UNDEFINED_STRICT", ["properties"], void 0, schema, "properties");
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
if (this.options.forceItems === true) {
|
|
221
|
+
if (schema.type === "array" || isArray && schema.type.includes("array")) {
|
|
222
|
+
if (schema.items === void 0) report.addError("KEYWORD_UNDEFINED_STRICT", ["items"], void 0, schema, "items");
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
if (this.options.forceMinItems === true) {
|
|
226
|
+
if (schema.type === "array" || isArray && schema.type.includes("array")) {
|
|
227
|
+
if (schema.minItems === void 0) report.addError("KEYWORD_UNDEFINED_STRICT", ["minItems"], void 0, schema, "minItems");
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
if (this.options.forceMaxItems === true) {
|
|
231
|
+
if (schema.type === "array" || isArray && schema.type.includes("array")) {
|
|
232
|
+
if (schema.maxItems === void 0) report.addError("KEYWORD_UNDEFINED_STRICT", ["maxItems"], void 0, schema, "maxItems");
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
if (this.options.forceMinLength === true) {
|
|
236
|
+
if (schema.type === "string" || isArray && schema.type.includes("string")) {
|
|
237
|
+
if (schema.minLength === void 0 && schema.format === void 0 && schema.enum === void 0 && schema.pattern === void 0) report.addError("KEYWORD_UNDEFINED_STRICT", ["minLength"], void 0, schema, "minLength");
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
if (this.options.forceMaxLength === true) {
|
|
241
|
+
if (schema.type === "string" || isArray && schema.type.includes("string")) {
|
|
242
|
+
if (schema.maxLength === void 0 && schema.format === void 0 && schema.enum === void 0 && schema.pattern === void 0) report.addError("KEYWORD_UNDEFINED_STRICT", ["maxLength"], void 0, schema, "maxLength");
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
allOf: function(report, schema) {
|
|
247
|
+
if (Array.isArray(schema.allOf) === false) report.addError("KEYWORD_TYPE_EXPECTED", ["allOf", "array"], void 0, schema, "allOf");
|
|
248
|
+
else if (schema.allOf.length === 0) report.addError("KEYWORD_MUST_BE", ["allOf", "an array with at least one element"], void 0, schema, "allOf");
|
|
249
|
+
else for (let idx = 0; idx < schema.allOf.length; idx++) {
|
|
250
|
+
report.path.push("allOf");
|
|
251
|
+
report.path.push(idx);
|
|
252
|
+
this.validateSchema(report, schema.allOf[idx]);
|
|
253
|
+
report.path.pop();
|
|
254
|
+
report.path.pop();
|
|
255
|
+
}
|
|
256
|
+
},
|
|
257
|
+
anyOf: function(report, schema) {
|
|
258
|
+
if (Array.isArray(schema.anyOf) === false) report.addError("KEYWORD_TYPE_EXPECTED", ["anyOf", "array"], void 0, schema, "anyOf");
|
|
259
|
+
else if (schema.anyOf.length === 0) report.addError("KEYWORD_MUST_BE", ["anyOf", "an array with at least one element"], void 0, schema, "anyOf");
|
|
260
|
+
else for (let idx = 0; idx < schema.anyOf.length; idx++) {
|
|
261
|
+
report.path.push("anyOf");
|
|
262
|
+
report.path.push(idx);
|
|
263
|
+
this.validateSchema(report, schema.anyOf[idx]);
|
|
264
|
+
report.path.pop();
|
|
265
|
+
report.path.pop();
|
|
266
|
+
}
|
|
267
|
+
},
|
|
268
|
+
oneOf: function(report, schema) {
|
|
269
|
+
if (Array.isArray(schema.oneOf) === false) report.addError("KEYWORD_TYPE_EXPECTED", ["oneOf", "array"], void 0, schema, "oneOf");
|
|
270
|
+
else if (schema.oneOf.length === 0) report.addError("KEYWORD_MUST_BE", ["oneOf", "an array with at least one element"], void 0, schema, "oneOf");
|
|
271
|
+
else for (let idx = 0; idx < schema.oneOf.length; idx++) {
|
|
272
|
+
report.path.push("oneOf");
|
|
273
|
+
report.path.push(idx);
|
|
274
|
+
this.validateSchema(report, schema.oneOf[idx]);
|
|
275
|
+
report.path.pop();
|
|
276
|
+
report.path.pop();
|
|
277
|
+
}
|
|
278
|
+
},
|
|
279
|
+
not: function(report, schema) {
|
|
280
|
+
const notSchema = schema.not;
|
|
281
|
+
if (!(report.options.version === "draft-04" ? isObject(notSchema) : typeof notSchema === "boolean" || isObject(notSchema))) report.addError("KEYWORD_TYPE_EXPECTED", ["not", report.options.version === "draft-04" ? "object" : ["boolean", "object"]], void 0, schema, "not");
|
|
282
|
+
else {
|
|
283
|
+
report.path.push("not");
|
|
284
|
+
this.validateSchema(report, notSchema);
|
|
285
|
+
report.path.pop();
|
|
286
|
+
}
|
|
287
|
+
},
|
|
288
|
+
if: function(report, schema) {
|
|
289
|
+
if (report.options.version !== "draft-07") return;
|
|
290
|
+
const ifSchema = schema.if;
|
|
291
|
+
if (!(typeof ifSchema === "boolean" || isObject(ifSchema))) {
|
|
292
|
+
report.addError("KEYWORD_TYPE_EXPECTED", ["if", ["boolean", "object"]], void 0, schema, "if");
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
report.path.push("if");
|
|
296
|
+
this.validateSchema(report, ifSchema);
|
|
297
|
+
report.path.pop();
|
|
298
|
+
},
|
|
299
|
+
then: function(report, schema) {
|
|
300
|
+
if (report.options.version !== "draft-07") return;
|
|
301
|
+
const thenSchema = schema.then;
|
|
302
|
+
if (!(typeof thenSchema === "boolean" || isObject(thenSchema))) {
|
|
303
|
+
report.addError("KEYWORD_TYPE_EXPECTED", ["then", ["boolean", "object"]], void 0, schema, "then");
|
|
304
|
+
return;
|
|
305
|
+
}
|
|
306
|
+
report.path.push("then");
|
|
307
|
+
this.validateSchema(report, thenSchema);
|
|
308
|
+
report.path.pop();
|
|
309
|
+
},
|
|
310
|
+
else: function(report, schema) {
|
|
311
|
+
if (report.options.version !== "draft-07") return;
|
|
312
|
+
const elseSchema = schema.else;
|
|
313
|
+
if (!(typeof elseSchema === "boolean" || isObject(elseSchema))) {
|
|
314
|
+
report.addError("KEYWORD_TYPE_EXPECTED", ["else", ["boolean", "object"]], void 0, schema, "else");
|
|
315
|
+
return;
|
|
316
|
+
}
|
|
317
|
+
report.path.push("else");
|
|
318
|
+
this.validateSchema(report, elseSchema);
|
|
319
|
+
report.path.pop();
|
|
320
|
+
},
|
|
321
|
+
definitions: function(report, schema) {
|
|
322
|
+
if (!isObject(schema.definitions)) report.addError("KEYWORD_TYPE_EXPECTED", ["definitions", "object"], void 0, schema, "definitions");
|
|
323
|
+
else {
|
|
324
|
+
const keys = Object.keys(schema.definitions);
|
|
325
|
+
for (const key of keys) {
|
|
326
|
+
const val = schema.definitions[key];
|
|
327
|
+
report.path.push("definitions");
|
|
328
|
+
report.path.push(key);
|
|
329
|
+
this.validateSchema(report, val);
|
|
330
|
+
report.path.pop();
|
|
331
|
+
report.path.pop();
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
},
|
|
335
|
+
$defs: function(report, schema) {
|
|
336
|
+
if (report.options.version !== "draft2019-09" && report.options.version !== "draft2020-12") return;
|
|
337
|
+
if (!isObject(schema.$defs)) {
|
|
338
|
+
report.addError("KEYWORD_TYPE_EXPECTED", ["$defs", "object"], void 0, schema, "$defs");
|
|
339
|
+
return;
|
|
340
|
+
}
|
|
341
|
+
const keys = Object.keys(schema.$defs);
|
|
342
|
+
for (const key of keys) {
|
|
343
|
+
const val = schema.$defs[key];
|
|
344
|
+
report.path.push("$defs");
|
|
345
|
+
report.path.push(key);
|
|
346
|
+
this.validateSchema(report, val);
|
|
347
|
+
report.path.pop();
|
|
348
|
+
report.path.pop();
|
|
349
|
+
}
|
|
350
|
+
},
|
|
351
|
+
format: function(report, schema) {
|
|
352
|
+
if (this.options.formatAssertions === false) return;
|
|
353
|
+
if (typeof schema.format !== "string") report.addError("KEYWORD_TYPE_EXPECTED", ["format", "string"], void 0, schema, "format");
|
|
354
|
+
else {
|
|
355
|
+
const isModernDraft = this.options.version === "draft2019-09" || this.options.version === "draft2020-12";
|
|
356
|
+
if (!isFormatSupported(schema.format, this.options.customFormats) && this.options.ignoreUnknownFormats !== true && !isModernDraft) report.addError("UNKNOWN_FORMAT", [schema.format], void 0, schema, "format");
|
|
357
|
+
}
|
|
358
|
+
},
|
|
359
|
+
contentEncoding: function(report, schema) {
|
|
360
|
+
if (report.options.version !== "draft-07") return;
|
|
361
|
+
if (typeof schema.contentEncoding !== "string") report.addError("KEYWORD_TYPE_EXPECTED", ["contentEncoding", "string"], void 0, schema, "contentEncoding");
|
|
362
|
+
},
|
|
363
|
+
contentMediaType: function(report, schema) {
|
|
364
|
+
if (report.options.version !== "draft-07") return;
|
|
365
|
+
if (typeof schema.contentMediaType !== "string") report.addError("KEYWORD_TYPE_EXPECTED", ["contentMediaType", "string"], void 0, schema, "contentMediaType");
|
|
366
|
+
},
|
|
367
|
+
id: function(report, schema) {
|
|
368
|
+
if (typeof schema.id !== "string") report.addError("KEYWORD_TYPE_EXPECTED", ["id", "string"], void 0, schema, "id");
|
|
369
|
+
},
|
|
370
|
+
title: function(report, schema) {
|
|
371
|
+
if (typeof schema.title !== "string") report.addError("KEYWORD_TYPE_EXPECTED", ["title", "string"], void 0, schema, "title");
|
|
372
|
+
},
|
|
373
|
+
description: function(report, schema) {
|
|
374
|
+
if (typeof schema.description !== "string") report.addError("KEYWORD_TYPE_EXPECTED", ["description", "string"], void 0, schema, "description");
|
|
375
|
+
},
|
|
376
|
+
default: function() {}
|
|
377
|
+
};
|
|
378
|
+
var SchemaValidator = class {
|
|
379
|
+
constructor(validator) {
|
|
380
|
+
this.validator = validator;
|
|
381
|
+
}
|
|
382
|
+
get options() {
|
|
383
|
+
return this.validator.options;
|
|
384
|
+
}
|
|
385
|
+
validateArrayOfSchemas(report, arr) {
|
|
386
|
+
for (const schema of arr) this.validateSchema(report, schema);
|
|
387
|
+
return report.isValid();
|
|
388
|
+
}
|
|
389
|
+
validateSchema(report, schema) {
|
|
390
|
+
report.commonErrorMessage = "SCHEMA_VALIDATION_FAILED";
|
|
391
|
+
if (Array.isArray(schema)) return this.validateArrayOfSchemas(report, schema);
|
|
392
|
+
if (typeof schema === "boolean") return true;
|
|
393
|
+
if (schema.__$validated) return true;
|
|
394
|
+
const hasParentSchema = schema.$schema && getId(schema) !== schema.$schema;
|
|
395
|
+
if (hasParentSchema) {
|
|
396
|
+
if (schema.__$schemaResolved && schema.__$schemaResolved !== schema) {
|
|
397
|
+
const subReport = new Report(report);
|
|
398
|
+
if (validate.call(this.validator, subReport, schema.__$schemaResolved, schema) === false) report.addError("PARENT_SCHEMA_VALIDATION_FAILED", void 0, subReport, schema, "$schema");
|
|
399
|
+
} else if (this.validator.options.ignoreUnresolvableReferences !== true) report.addError("REF_UNRESOLVED", [schema.$schema], void 0, schema, "$schema");
|
|
400
|
+
}
|
|
401
|
+
if (this.validator.options.noTypeless === true) {
|
|
402
|
+
if (schema.type !== void 0) {
|
|
403
|
+
let schemas = [];
|
|
404
|
+
if (Array.isArray(schema.anyOf)) schemas = schemas.concat(schema.anyOf);
|
|
405
|
+
if (Array.isArray(schema.oneOf)) schemas = schemas.concat(schema.oneOf);
|
|
406
|
+
if (Array.isArray(schema.allOf)) schemas = schemas.concat(schema.allOf);
|
|
407
|
+
schemas.forEach(function(sch) {
|
|
408
|
+
if (!sch.type) sch.type = schema.type;
|
|
409
|
+
});
|
|
410
|
+
}
|
|
411
|
+
if (schema.enum === void 0 && schema.type === void 0 && schema.anyOf === void 0 && schema.oneOf === void 0 && schema.not === void 0 && schema.$ref === void 0) report.addError("KEYWORD_UNDEFINED_STRICT", ["type"], void 0, schema, "type");
|
|
412
|
+
}
|
|
413
|
+
const keys = Object.keys(schema);
|
|
414
|
+
for (const key of keys) {
|
|
415
|
+
if (key.startsWith("__")) continue;
|
|
416
|
+
if (Object.hasOwn(SchemaValidators, key)) SchemaValidators[key].call(this, report, schema);
|
|
417
|
+
else if (!hasParentSchema) {
|
|
418
|
+
if (this.validator.options.noExtraKeywords === true) report.addError("KEYWORD_UNEXPECTED", [key], void 0, schema, void 0);
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
if (this.validator.options.pedanticCheck === true) {
|
|
422
|
+
if (schema.enum) {
|
|
423
|
+
const tmpSchema = shallowClone(schema);
|
|
424
|
+
delete tmpSchema.enum;
|
|
425
|
+
delete tmpSchema.default;
|
|
426
|
+
report.path.push("enum");
|
|
427
|
+
for (let idx = 0; idx < schema.enum.length; idx++) {
|
|
428
|
+
report.path.push(idx);
|
|
429
|
+
validate.call(this.validator, report, tmpSchema, schema.enum[idx]);
|
|
430
|
+
report.path.pop();
|
|
431
|
+
}
|
|
432
|
+
report.path.pop();
|
|
433
|
+
}
|
|
434
|
+
if (schema.default) {
|
|
435
|
+
report.path.push("default");
|
|
436
|
+
validate.call(this.validator, report, schema, schema.default);
|
|
437
|
+
report.path.pop();
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
const isValid = report.isValid();
|
|
441
|
+
if (isValid) schema.__$validated = true;
|
|
442
|
+
return isValid;
|
|
443
|
+
}
|
|
444
|
+
};
|
|
445
|
+
//#endregion
|
|
446
|
+
export { SchemaValidator };
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
//#region src/schemas/draft-04-schema.json
|
|
2
|
+
var draft_04_schema_default = {
|
|
3
|
+
id: "http://json-schema.org/draft-04/schema#",
|
|
4
|
+
$schema: "http://json-schema.org/draft-04/schema#",
|
|
5
|
+
description: "Core schema meta-schema",
|
|
6
|
+
definitions: {
|
|
7
|
+
"schemaArray": {
|
|
8
|
+
"type": "array",
|
|
9
|
+
"minItems": 1,
|
|
10
|
+
"items": { "$ref": "#" }
|
|
11
|
+
},
|
|
12
|
+
"positiveInteger": {
|
|
13
|
+
"type": "integer",
|
|
14
|
+
"minimum": 0
|
|
15
|
+
},
|
|
16
|
+
"positiveIntegerDefault0": { "allOf": [{ "$ref": "#/definitions/positiveInteger" }, { "default": 0 }] },
|
|
17
|
+
"simpleTypes": { "enum": [
|
|
18
|
+
"array",
|
|
19
|
+
"boolean",
|
|
20
|
+
"integer",
|
|
21
|
+
"null",
|
|
22
|
+
"number",
|
|
23
|
+
"object",
|
|
24
|
+
"string"
|
|
25
|
+
] },
|
|
26
|
+
"stringArray": {
|
|
27
|
+
"type": "array",
|
|
28
|
+
"items": { "type": "string" },
|
|
29
|
+
"minItems": 1,
|
|
30
|
+
"uniqueItems": true
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
type: "object",
|
|
34
|
+
properties: {
|
|
35
|
+
"id": { "type": "string" },
|
|
36
|
+
"$schema": { "type": "string" },
|
|
37
|
+
"title": { "type": "string" },
|
|
38
|
+
"description": { "type": "string" },
|
|
39
|
+
"default": {},
|
|
40
|
+
"multipleOf": {
|
|
41
|
+
"type": "number",
|
|
42
|
+
"minimum": 0,
|
|
43
|
+
"exclusiveMinimum": true
|
|
44
|
+
},
|
|
45
|
+
"maximum": { "type": "number" },
|
|
46
|
+
"exclusiveMaximum": {
|
|
47
|
+
"type": "boolean",
|
|
48
|
+
"default": false
|
|
49
|
+
},
|
|
50
|
+
"minimum": { "type": "number" },
|
|
51
|
+
"exclusiveMinimum": {
|
|
52
|
+
"type": "boolean",
|
|
53
|
+
"default": false
|
|
54
|
+
},
|
|
55
|
+
"maxLength": { "$ref": "#/definitions/positiveInteger" },
|
|
56
|
+
"minLength": { "$ref": "#/definitions/positiveIntegerDefault0" },
|
|
57
|
+
"pattern": {
|
|
58
|
+
"type": "string",
|
|
59
|
+
"format": "regex"
|
|
60
|
+
},
|
|
61
|
+
"additionalItems": {
|
|
62
|
+
"anyOf": [{ "type": "boolean" }, { "$ref": "#" }],
|
|
63
|
+
"default": {}
|
|
64
|
+
},
|
|
65
|
+
"items": {
|
|
66
|
+
"anyOf": [{ "$ref": "#" }, { "$ref": "#/definitions/schemaArray" }],
|
|
67
|
+
"default": {}
|
|
68
|
+
},
|
|
69
|
+
"maxItems": { "$ref": "#/definitions/positiveInteger" },
|
|
70
|
+
"minItems": { "$ref": "#/definitions/positiveIntegerDefault0" },
|
|
71
|
+
"uniqueItems": {
|
|
72
|
+
"type": "boolean",
|
|
73
|
+
"default": false
|
|
74
|
+
},
|
|
75
|
+
"maxProperties": { "$ref": "#/definitions/positiveInteger" },
|
|
76
|
+
"minProperties": { "$ref": "#/definitions/positiveIntegerDefault0" },
|
|
77
|
+
"required": { "$ref": "#/definitions/stringArray" },
|
|
78
|
+
"additionalProperties": {
|
|
79
|
+
"anyOf": [{ "type": "boolean" }, { "$ref": "#" }],
|
|
80
|
+
"default": {}
|
|
81
|
+
},
|
|
82
|
+
"definitions": {
|
|
83
|
+
"type": "object",
|
|
84
|
+
"additionalProperties": { "$ref": "#" },
|
|
85
|
+
"default": {}
|
|
86
|
+
},
|
|
87
|
+
"properties": {
|
|
88
|
+
"type": "object",
|
|
89
|
+
"additionalProperties": { "$ref": "#" },
|
|
90
|
+
"default": {}
|
|
91
|
+
},
|
|
92
|
+
"patternProperties": {
|
|
93
|
+
"type": "object",
|
|
94
|
+
"additionalProperties": { "$ref": "#" },
|
|
95
|
+
"default": {}
|
|
96
|
+
},
|
|
97
|
+
"dependencies": {
|
|
98
|
+
"type": "object",
|
|
99
|
+
"additionalProperties": { "anyOf": [{ "$ref": "#" }, { "$ref": "#/definitions/stringArray" }] }
|
|
100
|
+
},
|
|
101
|
+
"enum": {
|
|
102
|
+
"type": "array",
|
|
103
|
+
"minItems": 1,
|
|
104
|
+
"uniqueItems": true
|
|
105
|
+
},
|
|
106
|
+
"type": { "anyOf": [{ "$ref": "#/definitions/simpleTypes" }, {
|
|
107
|
+
"type": "array",
|
|
108
|
+
"items": { "$ref": "#/definitions/simpleTypes" },
|
|
109
|
+
"minItems": 1,
|
|
110
|
+
"uniqueItems": true
|
|
111
|
+
}] },
|
|
112
|
+
"format": { "type": "string" },
|
|
113
|
+
"allOf": { "$ref": "#/definitions/schemaArray" },
|
|
114
|
+
"anyOf": { "$ref": "#/definitions/schemaArray" },
|
|
115
|
+
"oneOf": { "$ref": "#/definitions/schemaArray" },
|
|
116
|
+
"not": { "$ref": "#" }
|
|
117
|
+
},
|
|
118
|
+
dependencies: {
|
|
119
|
+
"exclusiveMaximum": ["maximum"],
|
|
120
|
+
"exclusiveMinimum": ["minimum"]
|
|
121
|
+
},
|
|
122
|
+
"default": {}
|
|
123
|
+
};
|
|
124
|
+
//#endregion
|
|
125
|
+
export { draft_04_schema_default as default };
|