z-schema 12.2.0 → 12.4.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/README.md +2 -2
- package/bin/z-schema +1 -1
- package/cjs/{index.js → index.cjs} +838 -707
- package/cjs/{index.d.ts → index.d.cts} +47 -26
- package/dist/{errors.d.mts → errors.d.ts} +2 -2
- package/dist/{errors.mjs → errors.js} +1 -2
- package/dist/{format-validators.mjs → format-validators.js} +60 -43
- package/dist/{index.d.mts → index.d.ts} +9 -9
- package/dist/{index.mjs → index.js} +3 -3
- package/dist/{json-schema-versions.d.mts → json-schema-versions.d.ts} +34 -3
- package/dist/{json-schema.d.mts → json-schema.d.ts} +7 -7
- package/dist/{json-schema.mjs → json-schema.js} +6 -5
- package/dist/{json-validation.mjs → json-validation.js} +144 -127
- package/dist/{report.d.mts → report.d.ts} +8 -9
- package/dist/{report.mjs → report.js} +28 -31
- package/dist/{schema-cache.d.mts → schema-cache.d.ts} +5 -5
- package/dist/{schema-cache.mjs → schema-cache.js} +10 -11
- package/dist/{schema-compiler.d.mts → schema-compiler.d.ts} +4 -4
- package/dist/{schema-compiler.mjs → schema-compiler.js} +101 -79
- package/dist/{schema-validator.d.mts → schema-validator.d.ts} +5 -5
- package/dist/{schema-validator.mjs → schema-validator.js} +138 -166
- package/dist/utils/{array.mjs → array.js} +4 -3
- package/dist/utils/{base64.mjs → base64.js} +3 -2
- package/dist/utils/{clone.mjs → clone.js} +18 -20
- package/dist/utils/hostname.js +176 -0
- package/dist/utils/{json.mjs → json.js} +13 -8
- package/dist/utils/{schema-regex.mjs → schema-regex.js} +5 -5
- package/dist/utils/{time.mjs → time.js} +8 -8
- package/dist/utils/unicode.js +22 -0
- package/dist/utils/{what-is.mjs → what-is.js} +1 -2
- package/dist/validation/{array.mjs → array.js} +18 -20
- package/dist/validation/{combinators.mjs → combinators.js} +16 -16
- package/dist/validation/{numeric.mjs → numeric.js} +11 -11
- package/dist/validation/{object.mjs → object.js} +35 -34
- package/dist/validation/{ref.mjs → ref.js} +5 -5
- package/dist/validation/{shared.mjs → shared.js} +15 -12
- package/dist/validation/{string.mjs → string.js} +35 -35
- package/dist/validation/type.js +34 -0
- package/dist/{z-schema-base.d.mts → z-schema-base.d.ts} +11 -12
- package/dist/{z-schema-base.mjs → z-schema-base.js} +45 -40
- package/dist/{z-schema-options.d.mts → z-schema-options.d.ts} +3 -3
- package/dist/{z-schema-options.mjs → z-schema-options.js} +5 -5
- package/dist/{z-schema-reader.d.mts → z-schema-reader.d.ts} +1 -1
- package/dist/{z-schema-versions.mjs → z-schema-versions.js} +21 -21
- package/dist/{z-schema.d.mts → z-schema.d.ts} +5 -13
- package/dist/{z-schema.mjs → z-schema.js} +38 -48
- package/package.json +24 -25
- package/src/errors.ts +1 -2
- package/src/format-validators.ts +173 -67
- package/src/json-schema-versions.ts +56 -2
- package/src/json-schema.ts +10 -9
- package/src/json-validation.ts +189 -146
- package/src/report.ts +37 -49
- package/src/schema-cache.ts +13 -13
- package/src/schema-compiler.ts +170 -117
- package/src/schema-validator.ts +239 -238
- package/src/utils/array.ts +9 -6
- package/src/utils/base64.ts +13 -2
- package/src/utils/clone.ts +28 -30
- package/src/utils/date.ts +6 -3
- package/src/utils/hostname.ts +257 -31
- package/src/utils/json.ts +16 -9
- package/src/utils/properties.ts +2 -2
- package/src/utils/schema-regex.ts +4 -4
- package/src/utils/time.ts +8 -7
- package/src/utils/unicode.ts +12 -5
- package/src/utils/what-is.ts +1 -5
- package/src/validation/array.ts +24 -22
- package/src/validation/combinators.ts +14 -14
- package/src/validation/numeric.ts +14 -28
- package/src/validation/object.ts +32 -36
- package/src/validation/ref.ts +5 -6
- package/src/validation/shared.ts +22 -21
- package/src/validation/string.ts +36 -42
- package/src/validation/type.ts +17 -17
- package/src/z-schema-base.ts +49 -38
- package/src/z-schema-options.ts +4 -3
- package/src/z-schema.ts +35 -45
- package/umd/ZSchema.js +853 -715
- package/umd/ZSchema.min.js +2 -2
- package/umd/package.json +3 -0
- package/dist/utils/hostname.mjs +0 -75
- package/dist/utils/unicode.mjs +0 -12
- package/dist/validation/type.mjs +0 -32
- /package/dist/{format-validators.d.mts → format-validators.d.ts} +0 -0
- /package/dist/{json-schema-versions.mjs → json-schema-versions.js} +0 -0
- /package/dist/schemas/{draft-04-schema.mjs → draft-04-schema.js} +0 -0
- /package/dist/schemas/{draft-06-schema.mjs → draft-06-schema.js} +0 -0
- /package/dist/schemas/{draft-07-schema.mjs → draft-07-schema.js} +0 -0
- /package/dist/schemas/{draft-2019-09-meta-applicator.mjs → draft-2019-09-meta-applicator.js} +0 -0
- /package/dist/schemas/{draft-2019-09-meta-content.mjs → draft-2019-09-meta-content.js} +0 -0
- /package/dist/schemas/{draft-2019-09-meta-core.mjs → draft-2019-09-meta-core.js} +0 -0
- /package/dist/schemas/{draft-2019-09-meta-format.mjs → draft-2019-09-meta-format.js} +0 -0
- /package/dist/schemas/{draft-2019-09-meta-meta-data.mjs → draft-2019-09-meta-meta-data.js} +0 -0
- /package/dist/schemas/{draft-2019-09-meta-validation.mjs → draft-2019-09-meta-validation.js} +0 -0
- /package/dist/schemas/{draft-2019-09-schema.mjs → draft-2019-09-schema.js} +0 -0
- /package/dist/schemas/{draft-2020-12-meta-applicator.mjs → draft-2020-12-meta-applicator.js} +0 -0
- /package/dist/schemas/{draft-2020-12-meta-content.mjs → draft-2020-12-meta-content.js} +0 -0
- /package/dist/schemas/{draft-2020-12-meta-core.mjs → draft-2020-12-meta-core.js} +0 -0
- /package/dist/schemas/{draft-2020-12-meta-format-annotation.mjs → draft-2020-12-meta-format-annotation.js} +0 -0
- /package/dist/schemas/{draft-2020-12-meta-format-assertion.mjs → draft-2020-12-meta-format-assertion.js} +0 -0
- /package/dist/schemas/{draft-2020-12-meta-meta-data.mjs → draft-2020-12-meta-meta-data.js} +0 -0
- /package/dist/schemas/{draft-2020-12-meta-unevaluated.mjs → draft-2020-12-meta-unevaluated.js} +0 -0
- /package/dist/schemas/{draft-2020-12-meta-validation.mjs → draft-2020-12-meta-validation.js} +0 -0
- /package/dist/schemas/{draft-2020-12-schema.mjs → draft-2020-12-schema.js} +0 -0
- /package/dist/utils/{constants.mjs → constants.js} +0 -0
- /package/dist/utils/{date.mjs → date.js} +0 -0
- /package/dist/utils/{properties.mjs → properties.js} +0 -0
- /package/dist/utils/{symbols.mjs → symbols.js} +0 -0
- /package/dist/utils/{uri.mjs → uri.js} +0 -0
- /package/dist/{z-schema-reader.mjs → z-schema-reader.js} +0 -0
package/src/utils/time.ts
CHANGED
|
@@ -24,7 +24,8 @@ export interface ParsedRfc3339Time {
|
|
|
24
24
|
utcMinute: number;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
const RFC3339_TIME_REGEX =
|
|
27
|
+
const RFC3339_TIME_REGEX =
|
|
28
|
+
/^(?<hour>[0-9]{2}):(?<minute>[0-9]{2}):(?<second>[0-9]{2})(?<fraction>\.[0-9]+)?(?<offset>z|(?<offsetValue>[+-][0-9]{2}:[0-9]{2}))$/i;
|
|
28
29
|
|
|
29
30
|
export const parseRfc3339Time = (time: string): ParsedRfc3339Time | null => {
|
|
30
31
|
const matches = RFC3339_TIME_REGEX.exec(time);
|
|
@@ -32,9 +33,9 @@ export const parseRfc3339Time = (time: string): ParsedRfc3339Time | null => {
|
|
|
32
33
|
return null;
|
|
33
34
|
}
|
|
34
35
|
|
|
35
|
-
const hour = parseInt(matches[1], 10);
|
|
36
|
-
const minute = parseInt(matches[2], 10);
|
|
37
|
-
const second = parseInt(matches[3], 10);
|
|
36
|
+
const hour = Number.parseInt(matches[1], 10);
|
|
37
|
+
const minute = Number.parseInt(matches[2], 10);
|
|
38
|
+
const second = Number.parseInt(matches[3], 10);
|
|
38
39
|
if (hour > 23 || minute > 59 || second > 60) {
|
|
39
40
|
return null;
|
|
40
41
|
}
|
|
@@ -42,14 +43,14 @@ export const parseRfc3339Time = (time: string): ParsedRfc3339Time | null => {
|
|
|
42
43
|
let utcHour = hour;
|
|
43
44
|
let utcMinute = minute;
|
|
44
45
|
if (matches[5].toLowerCase() !== 'z') {
|
|
45
|
-
const offsetMatches = /^([+-])([0-9]{2}):([0-9]{2})$/.exec(matches[5]);
|
|
46
|
+
const offsetMatches = /^(?<sign>[+-])(?<hour>[0-9]{2}):(?<minute>[0-9]{2})$/.exec(matches[5]);
|
|
46
47
|
if (offsetMatches === null) {
|
|
47
48
|
return null;
|
|
48
49
|
}
|
|
49
50
|
|
|
50
51
|
const offsetSign = offsetMatches[1] as '+' | '-';
|
|
51
|
-
const offsetHour = parseInt(offsetMatches[2], 10);
|
|
52
|
-
const offsetMinute = parseInt(offsetMatches[3], 10);
|
|
52
|
+
const offsetHour = Number.parseInt(offsetMatches[2], 10);
|
|
53
|
+
const offsetMinute = Number.parseInt(offsetMatches[3], 10);
|
|
53
54
|
if (offsetHour > 23 || offsetMinute > 59) {
|
|
54
55
|
return null;
|
|
55
56
|
}
|
package/src/utils/unicode.ts
CHANGED
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Returns the number of Unicode code points in the string.
|
|
3
|
-
* Uses
|
|
3
|
+
* Uses a surrogate-aware charCodeAt scan (equivalent to the string iterator)
|
|
4
|
+
* that counts a surrogate pair as one code point and lone surrogates as one each.
|
|
4
5
|
*/
|
|
5
6
|
export function unicodeLength(str: string): number {
|
|
6
|
-
let count =
|
|
7
|
-
for (
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
let count = str.length;
|
|
8
|
+
for (let i = 0; i < str.length - 1; i++) {
|
|
9
|
+
const hi = str.charCodeAt(i);
|
|
10
|
+
if (hi >= 0xd8_00 && hi <= 0xdb_ff) {
|
|
11
|
+
const lo = str.charCodeAt(i + 1);
|
|
12
|
+
if (lo >= 0xdc_00 && lo <= 0xdf_ff) {
|
|
13
|
+
count--;
|
|
14
|
+
i++;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
10
17
|
}
|
|
11
18
|
return count;
|
|
12
19
|
}
|
package/src/utils/what-is.ts
CHANGED
|
@@ -26,11 +26,7 @@ export const whatIs = (what: unknown): WHAT_IS => {
|
|
|
26
26
|
|
|
27
27
|
if (typeof what === 'number') {
|
|
28
28
|
if (Number.isFinite(what)) {
|
|
29
|
-
|
|
30
|
-
return 'integer';
|
|
31
|
-
} else {
|
|
32
|
-
return 'number';
|
|
33
|
-
}
|
|
29
|
+
return what % 1 === 0 ? 'integer' : 'number';
|
|
34
30
|
}
|
|
35
31
|
if (Number.isNaN(what)) {
|
|
36
32
|
return 'not-a-number';
|
package/src/validation/array.ts
CHANGED
|
@@ -9,9 +9,9 @@ import { cacheValidationResult, deferOrRunSync, shouldSkipValidate } from './sha
|
|
|
9
9
|
// additionalItems
|
|
10
10
|
// ---------------------------------------------------------------------------
|
|
11
11
|
|
|
12
|
-
export function additionalItemsValidator(
|
|
12
|
+
export function additionalItemsValidator(ctx: ZSchemaBase, report: Report, schema: JsonSchemaInternal, json: unknown) {
|
|
13
13
|
// http://json-schema.org/latest/json-schema-validation.html#rfc.section.5.3.1.2
|
|
14
|
-
if (shouldSkipValidate(
|
|
14
|
+
if (shouldSkipValidate(ctx.validateOptions, ['ARRAY_ADDITIONAL_ITEMS'])) {
|
|
15
15
|
return;
|
|
16
16
|
}
|
|
17
17
|
if (!Array.isArray(json)) {
|
|
@@ -19,10 +19,8 @@ export function additionalItemsValidator(this: ZSchemaBase, report: Report, sche
|
|
|
19
19
|
}
|
|
20
20
|
// if the value of "additionalItems" is boolean value false and the value of "items" is an array,
|
|
21
21
|
// the json is valid if its size is less than, or equal to, the size of "items".
|
|
22
|
-
if (schema.additionalItems === false && Array.isArray(schema.items)) {
|
|
23
|
-
|
|
24
|
-
report.addError('ARRAY_ADDITIONAL_ITEMS', undefined, undefined, schema, 'additionalItems');
|
|
25
|
-
}
|
|
22
|
+
if (schema.additionalItems === false && Array.isArray(schema.items) && json.length > schema.items.length) {
|
|
23
|
+
report.addError('ARRAY_ADDITIONAL_ITEMS', undefined, undefined, schema, 'additionalItems');
|
|
26
24
|
}
|
|
27
25
|
}
|
|
28
26
|
|
|
@@ -47,9 +45,9 @@ export function prefixItemsValidator() {
|
|
|
47
45
|
// maxItems
|
|
48
46
|
// ---------------------------------------------------------------------------
|
|
49
47
|
|
|
50
|
-
export function maxItemsValidator(
|
|
48
|
+
export function maxItemsValidator(ctx: ZSchemaBase, report: Report, schema: JsonSchemaInternal, json: unknown) {
|
|
51
49
|
// http://json-schema.org/latest/json-schema-validation.html#rfc.section.5.3.2.2
|
|
52
|
-
if (shouldSkipValidate(
|
|
50
|
+
if (shouldSkipValidate(ctx.validateOptions, ['ARRAY_LENGTH_LONG'])) {
|
|
53
51
|
return;
|
|
54
52
|
}
|
|
55
53
|
if (!Array.isArray(json)) {
|
|
@@ -64,9 +62,9 @@ export function maxItemsValidator(this: ZSchemaBase, report: Report, schema: Jso
|
|
|
64
62
|
// minItems
|
|
65
63
|
// ---------------------------------------------------------------------------
|
|
66
64
|
|
|
67
|
-
export function minItemsValidator(
|
|
65
|
+
export function minItemsValidator(ctx: ZSchemaBase, report: Report, schema: JsonSchemaInternal, json: unknown) {
|
|
68
66
|
// http://json-schema.org/latest/json-schema-validation.html#rfc.section.5.3.3.2
|
|
69
|
-
if (shouldSkipValidate(
|
|
67
|
+
if (shouldSkipValidate(ctx.validateOptions, ['ARRAY_LENGTH_SHORT'])) {
|
|
70
68
|
return;
|
|
71
69
|
}
|
|
72
70
|
if (!Array.isArray(json)) {
|
|
@@ -81,9 +79,9 @@ export function minItemsValidator(this: ZSchemaBase, report: Report, schema: Jso
|
|
|
81
79
|
// uniqueItems
|
|
82
80
|
// ---------------------------------------------------------------------------
|
|
83
81
|
|
|
84
|
-
export function uniqueItemsValidator(
|
|
82
|
+
export function uniqueItemsValidator(ctx: ZSchemaBase, report: Report, schema: JsonSchemaInternal, json: unknown) {
|
|
85
83
|
// http://json-schema.org/latest/json-schema-validation.html#rfc.section.5.3.4.2
|
|
86
|
-
if (shouldSkipValidate(
|
|
84
|
+
if (shouldSkipValidate(ctx.validateOptions, ['ARRAY_UNIQUE'])) {
|
|
87
85
|
return;
|
|
88
86
|
}
|
|
89
87
|
if (!Array.isArray(json)) {
|
|
@@ -91,7 +89,7 @@ export function uniqueItemsValidator(this: ZSchemaBase, report: Report, schema:
|
|
|
91
89
|
}
|
|
92
90
|
if (schema.uniqueItems === true) {
|
|
93
91
|
const matches: any[] = [];
|
|
94
|
-
if (isUniqueArray(json, matches,
|
|
92
|
+
if (!isUniqueArray(json, matches, ctx.options.maxRecursionDepth)) {
|
|
95
93
|
report.addError('ARRAY_UNIQUE', matches, undefined, schema, 'uniqueItems');
|
|
96
94
|
}
|
|
97
95
|
}
|
|
@@ -101,8 +99,8 @@ export function uniqueItemsValidator(this: ZSchemaBase, report: Report, schema:
|
|
|
101
99
|
// contains
|
|
102
100
|
// ---------------------------------------------------------------------------
|
|
103
101
|
|
|
104
|
-
export function containsValidator(
|
|
105
|
-
if (shouldSkipValidate(
|
|
102
|
+
export function containsValidator(ctx: ZSchemaBase, report: Report, schema: JsonSchemaInternal, json: unknown) {
|
|
103
|
+
if (shouldSkipValidate(ctx.validateOptions, ['CONTAINS'])) {
|
|
106
104
|
return;
|
|
107
105
|
}
|
|
108
106
|
|
|
@@ -120,19 +118,19 @@ export function containsValidator(this: ZSchemaBase, report: Report, schema: Jso
|
|
|
120
118
|
for (let idx = 0; idx < json.length; idx++) {
|
|
121
119
|
const subReport = new Report_(report);
|
|
122
120
|
subReports.push(subReport);
|
|
123
|
-
|
|
121
|
+
ctx._jsonValidate(subReport, containsSchema, json[idx]);
|
|
124
122
|
cacheValidationResult(report, containsSchema, json[idx], subReport.errors.length === 0);
|
|
125
123
|
}
|
|
126
124
|
|
|
127
125
|
const addContainsErrorIfNeeded = () => {
|
|
128
126
|
let matchingItems = 0;
|
|
129
|
-
for (
|
|
130
|
-
if (
|
|
127
|
+
for (let i = 0; i < subReports.length; i++) {
|
|
128
|
+
if (subReports[i].errors.length === 0) {
|
|
131
129
|
matchingItems += 1;
|
|
132
130
|
}
|
|
133
131
|
}
|
|
134
132
|
|
|
135
|
-
const supportsContainsBounds =
|
|
133
|
+
const supportsContainsBounds = ctx.options.version === 'draft2019-09' || ctx.options.version === 'draft2020-12';
|
|
136
134
|
const minContains: number =
|
|
137
135
|
supportsContainsBounds && typeof schema.minContains === 'number' ? (schema.minContains ?? 1) : 1;
|
|
138
136
|
const maxContains =
|
|
@@ -142,7 +140,7 @@ export function containsValidator(this: ZSchemaBase, report: Report, schema: Jso
|
|
|
142
140
|
const notTooManyMatches = maxContains === undefined || matchingItems <= maxContains;
|
|
143
141
|
|
|
144
142
|
if (!hasEnoughMatches || !notTooManyMatches) {
|
|
145
|
-
report.addError('CONTAINS', undefined, subReports, schema
|
|
143
|
+
report.addError('CONTAINS', undefined, subReports, schema);
|
|
146
144
|
}
|
|
147
145
|
};
|
|
148
146
|
|
|
@@ -153,5 +151,9 @@ export function containsValidator(this: ZSchemaBase, report: Report, schema: Jso
|
|
|
153
151
|
// maxContains / minContains (no-op — handled inside contains)
|
|
154
152
|
// ---------------------------------------------------------------------------
|
|
155
153
|
|
|
156
|
-
export function maxContainsValidator() {
|
|
157
|
-
|
|
154
|
+
export function maxContainsValidator() {
|
|
155
|
+
// no-op: maxContains is evaluated inside the `contains` validator
|
|
156
|
+
}
|
|
157
|
+
export function minContainsValidator() {
|
|
158
|
+
// no-op: minContains is evaluated inside the `contains` validator
|
|
159
|
+
}
|
|
@@ -8,11 +8,11 @@ import { cacheValidationResult, deferOrRunSync } from './shared.js';
|
|
|
8
8
|
// allOf
|
|
9
9
|
// ---------------------------------------------------------------------------
|
|
10
10
|
|
|
11
|
-
export function allOfValidator(
|
|
11
|
+
export function allOfValidator(ctx: ZSchemaBase, report: Report, schema: JsonSchemaInternal, json: unknown) {
|
|
12
12
|
// http://json-schema.org/latest/json-schema-validation.html#rfc.section.5.5.3.2
|
|
13
13
|
for (let i = 0; i < schema.allOf!.length; i++) {
|
|
14
|
-
const validateResult =
|
|
15
|
-
if (
|
|
14
|
+
const validateResult = ctx._jsonValidate(report, schema.allOf![i], json);
|
|
15
|
+
if (ctx.options.breakOnFirstError && !validateResult) {
|
|
16
16
|
break;
|
|
17
17
|
}
|
|
18
18
|
}
|
|
@@ -22,14 +22,14 @@ export function allOfValidator(this: ZSchemaBase, report: Report, schema: JsonSc
|
|
|
22
22
|
// anyOf
|
|
23
23
|
// ---------------------------------------------------------------------------
|
|
24
24
|
|
|
25
|
-
export function anyOfValidator(
|
|
25
|
+
export function anyOfValidator(ctx: ZSchemaBase, report: Report, schema: JsonSchemaInternal, json: unknown) {
|
|
26
26
|
// http://json-schema.org/latest/json-schema-validation.html#rfc.section.5.5.4.2
|
|
27
27
|
const subReports: Report[] = [];
|
|
28
28
|
|
|
29
29
|
for (let i = 0; i < schema.anyOf!.length; i++) {
|
|
30
30
|
const subReport = new Report(report);
|
|
31
31
|
subReports.push(subReport);
|
|
32
|
-
|
|
32
|
+
ctx._jsonValidate(subReport, schema.anyOf![i], json);
|
|
33
33
|
cacheValidationResult(report, schema.anyOf![i], json, subReport.errors.length === 0);
|
|
34
34
|
}
|
|
35
35
|
|
|
@@ -43,7 +43,7 @@ export function anyOfValidator(this: ZSchemaBase, report: Report, schema: JsonSc
|
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
if (passed
|
|
46
|
+
if (!passed) {
|
|
47
47
|
report.addError('ANY_OF_MISSING', undefined, subReports, schema, 'anyOf');
|
|
48
48
|
}
|
|
49
49
|
});
|
|
@@ -53,14 +53,14 @@ export function anyOfValidator(this: ZSchemaBase, report: Report, schema: JsonSc
|
|
|
53
53
|
// oneOf
|
|
54
54
|
// ---------------------------------------------------------------------------
|
|
55
55
|
|
|
56
|
-
export function oneOfValidator(
|
|
56
|
+
export function oneOfValidator(ctx: ZSchemaBase, report: Report, schema: JsonSchemaInternal, json: unknown) {
|
|
57
57
|
// http://json-schema.org/latest/json-schema-validation.html#rfc.section.5.5.5.2
|
|
58
58
|
const subReports: Report[] = [];
|
|
59
59
|
|
|
60
60
|
for (let i = 0; i < schema.oneOf!.length; i++) {
|
|
61
61
|
const subReport = new Report(report);
|
|
62
62
|
subReports.push(subReport);
|
|
63
|
-
|
|
63
|
+
ctx._jsonValidate(subReport, schema.oneOf![i], json);
|
|
64
64
|
cacheValidationResult(report, schema.oneOf![i], json, subReport.errors.length === 0);
|
|
65
65
|
}
|
|
66
66
|
|
|
@@ -85,10 +85,10 @@ export function oneOfValidator(this: ZSchemaBase, report: Report, schema: JsonSc
|
|
|
85
85
|
// not
|
|
86
86
|
// ---------------------------------------------------------------------------
|
|
87
87
|
|
|
88
|
-
export function notValidator(
|
|
88
|
+
export function notValidator(ctx: ZSchemaBase, report: Report, schema: JsonSchemaInternal, json: unknown) {
|
|
89
89
|
// http://json-schema.org/latest/json-schema-validation.html#rfc.section.5.5.6.2
|
|
90
90
|
const subReport = new Report(report);
|
|
91
|
-
if (
|
|
91
|
+
if (ctx._jsonValidate(subReport, schema.not!, json)) {
|
|
92
92
|
report.addError('NOT_PASSED', undefined, undefined, schema, 'not');
|
|
93
93
|
}
|
|
94
94
|
}
|
|
@@ -97,8 +97,8 @@ export function notValidator(this: ZSchemaBase, report: Report, schema: JsonSche
|
|
|
97
97
|
// if / then / else
|
|
98
98
|
// ---------------------------------------------------------------------------
|
|
99
99
|
|
|
100
|
-
export function ifValidator(
|
|
101
|
-
if (
|
|
100
|
+
export function ifValidator(ctx: ZSchemaBase, report: Report, schema: JsonSchemaInternal, json: unknown) {
|
|
101
|
+
if (ctx.options.version === 'draft-04' || ctx.options.version === 'draft-06') {
|
|
102
102
|
return;
|
|
103
103
|
}
|
|
104
104
|
|
|
@@ -111,7 +111,7 @@ export function ifValidator(this: ZSchemaBase, report: Report, schema: JsonSchem
|
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
const conditionReport = new Report(report);
|
|
114
|
-
|
|
114
|
+
ctx._jsonValidate(conditionReport, conditionSchema, json);
|
|
115
115
|
cacheValidationResult(report, conditionSchema, json, conditionReport.errors.length === 0);
|
|
116
116
|
|
|
117
117
|
const branchSchema = conditionReport.errors.length === 0 ? thenSchema : elseSchema;
|
|
@@ -119,7 +119,7 @@ export function ifValidator(this: ZSchemaBase, report: Report, schema: JsonSchem
|
|
|
119
119
|
return;
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
-
|
|
122
|
+
ctx._jsonValidate(report, branchSchema, json);
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
export function thenValidator() {
|
|
@@ -8,9 +8,9 @@ import { shouldSkipValidate } from './shared.js';
|
|
|
8
8
|
// multipleOf
|
|
9
9
|
// ---------------------------------------------------------------------------
|
|
10
10
|
|
|
11
|
-
export function multipleOfValidator(
|
|
11
|
+
export function multipleOfValidator(ctx: ZSchemaBase, report: Report, schema: JsonSchemaInternal, json: unknown) {
|
|
12
12
|
// http://json-schema.org/latest/json-schema-validation.html#rfc.section.5.1.1.2
|
|
13
|
-
if (shouldSkipValidate(
|
|
13
|
+
if (shouldSkipValidate(ctx.validateOptions, ['MULTIPLE_OF'])) {
|
|
14
14
|
return;
|
|
15
15
|
}
|
|
16
16
|
if (typeof json !== 'number') {
|
|
@@ -27,9 +27,9 @@ export function multipleOfValidator(this: ZSchemaBase, report: Report, schema: J
|
|
|
27
27
|
// maximum
|
|
28
28
|
// ---------------------------------------------------------------------------
|
|
29
29
|
|
|
30
|
-
export function maximumValidator(
|
|
30
|
+
export function maximumValidator(ctx: ZSchemaBase, report: Report, schema: JsonSchemaInternal, json: unknown) {
|
|
31
31
|
// http://json-schema.org/latest/json-schema-validation.html#rfc.section.5.1.2.2
|
|
32
|
-
if (shouldSkipValidate(
|
|
32
|
+
if (shouldSkipValidate(ctx.validateOptions, ['MAXIMUM', 'MAXIMUM_EXCLUSIVE'])) {
|
|
33
33
|
return;
|
|
34
34
|
}
|
|
35
35
|
if (typeof json !== 'number') {
|
|
@@ -39,10 +39,8 @@ export function maximumValidator(this: ZSchemaBase, report: Report, schema: Json
|
|
|
39
39
|
if (json > schema.maximum!) {
|
|
40
40
|
report.addError('MAXIMUM', [json, schema.maximum!], undefined, schema, 'maximum');
|
|
41
41
|
}
|
|
42
|
-
} else {
|
|
43
|
-
|
|
44
|
-
report.addError('MAXIMUM_EXCLUSIVE', [json, schema.maximum!], undefined, schema, 'maximum');
|
|
45
|
-
}
|
|
42
|
+
} else if (json >= schema.maximum!) {
|
|
43
|
+
report.addError('MAXIMUM_EXCLUSIVE', [json, schema.maximum!], undefined, schema, 'maximum');
|
|
46
44
|
}
|
|
47
45
|
}
|
|
48
46
|
|
|
@@ -50,15 +48,10 @@ export function maximumValidator(this: ZSchemaBase, report: Report, schema: Json
|
|
|
50
48
|
// exclusiveMaximum
|
|
51
49
|
// ---------------------------------------------------------------------------
|
|
52
50
|
|
|
53
|
-
export function exclusiveMaximumValidator(
|
|
54
|
-
this: ZSchemaBase,
|
|
55
|
-
report: Report,
|
|
56
|
-
schema: JsonSchemaInternal,
|
|
57
|
-
json: unknown
|
|
58
|
-
) {
|
|
51
|
+
export function exclusiveMaximumValidator(ctx: ZSchemaBase, report: Report, schema: JsonSchemaInternal, json: unknown) {
|
|
59
52
|
// In draft-06+, exclusiveMaximum is a standalone number
|
|
60
53
|
if (typeof schema.exclusiveMaximum === 'number') {
|
|
61
|
-
if (shouldSkipValidate(
|
|
54
|
+
if (shouldSkipValidate(ctx.validateOptions, ['MAXIMUM_EXCLUSIVE'])) {
|
|
62
55
|
return;
|
|
63
56
|
}
|
|
64
57
|
if (typeof json !== 'number') {
|
|
@@ -75,9 +68,9 @@ export function exclusiveMaximumValidator(
|
|
|
75
68
|
// minimum
|
|
76
69
|
// ---------------------------------------------------------------------------
|
|
77
70
|
|
|
78
|
-
export function minimumValidator(
|
|
71
|
+
export function minimumValidator(ctx: ZSchemaBase, report: Report, schema: JsonSchemaInternal, json: unknown) {
|
|
79
72
|
// http://json-schema.org/latest/json-schema-validation.html#rfc.section.5.1.3.2
|
|
80
|
-
if (shouldSkipValidate(
|
|
73
|
+
if (shouldSkipValidate(ctx.validateOptions, ['MINIMUM', 'MINIMUM_EXCLUSIVE'])) {
|
|
81
74
|
return;
|
|
82
75
|
}
|
|
83
76
|
if (typeof json !== 'number') {
|
|
@@ -87,10 +80,8 @@ export function minimumValidator(this: ZSchemaBase, report: Report, schema: Json
|
|
|
87
80
|
if (json < schema.minimum!) {
|
|
88
81
|
report.addError('MINIMUM', [json, schema.minimum!], undefined, schema, 'minimum');
|
|
89
82
|
}
|
|
90
|
-
} else {
|
|
91
|
-
|
|
92
|
-
report.addError('MINIMUM_EXCLUSIVE', [json, schema.minimum!], undefined, schema, 'minimum');
|
|
93
|
-
}
|
|
83
|
+
} else if (json <= schema.minimum!) {
|
|
84
|
+
report.addError('MINIMUM_EXCLUSIVE', [json, schema.minimum!], undefined, schema, 'minimum');
|
|
94
85
|
}
|
|
95
86
|
}
|
|
96
87
|
|
|
@@ -98,15 +89,10 @@ export function minimumValidator(this: ZSchemaBase, report: Report, schema: Json
|
|
|
98
89
|
// exclusiveMinimum
|
|
99
90
|
// ---------------------------------------------------------------------------
|
|
100
91
|
|
|
101
|
-
export function exclusiveMinimumValidator(
|
|
102
|
-
this: ZSchemaBase,
|
|
103
|
-
report: Report,
|
|
104
|
-
schema: JsonSchemaInternal,
|
|
105
|
-
json: unknown
|
|
106
|
-
) {
|
|
92
|
+
export function exclusiveMinimumValidator(ctx: ZSchemaBase, report: Report, schema: JsonSchemaInternal, json: unknown) {
|
|
107
93
|
// In draft-06+, exclusiveMinimum is a standalone number
|
|
108
94
|
if (typeof schema.exclusiveMinimum === 'number') {
|
|
109
|
-
if (shouldSkipValidate(
|
|
95
|
+
if (shouldSkipValidate(ctx.validateOptions, ['MINIMUM_EXCLUSIVE'])) {
|
|
110
96
|
return;
|
|
111
97
|
}
|
|
112
98
|
if (typeof json !== 'number') {
|
package/src/validation/object.ts
CHANGED
|
@@ -11,9 +11,9 @@ import { deferOrRunSync, shouldSkipValidate, supportsDependentKeywords } from '.
|
|
|
11
11
|
// maxProperties
|
|
12
12
|
// ---------------------------------------------------------------------------
|
|
13
13
|
|
|
14
|
-
export function maxPropertiesValidator(
|
|
14
|
+
export function maxPropertiesValidator(ctx: ZSchemaBase, report: Report, schema: JsonSchemaInternal, json: unknown) {
|
|
15
15
|
// http://json-schema.org/latest/json-schema-validation.html#rfc.section.5.4.1.2
|
|
16
|
-
if (shouldSkipValidate(
|
|
16
|
+
if (shouldSkipValidate(ctx.validateOptions, ['OBJECT_PROPERTIES_MAXIMUM'])) {
|
|
17
17
|
return;
|
|
18
18
|
}
|
|
19
19
|
if (!isObject(json)) {
|
|
@@ -35,9 +35,9 @@ export function maxPropertiesValidator(this: ZSchemaBase, report: Report, schema
|
|
|
35
35
|
// minProperties
|
|
36
36
|
// ---------------------------------------------------------------------------
|
|
37
37
|
|
|
38
|
-
export function minPropertiesValidator(
|
|
38
|
+
export function minPropertiesValidator(ctx: ZSchemaBase, report: Report, schema: JsonSchemaInternal, json: unknown) {
|
|
39
39
|
// http://json-schema.org/latest/json-schema-validation.html#rfc.section.5.4.2.2
|
|
40
|
-
if (shouldSkipValidate(
|
|
40
|
+
if (shouldSkipValidate(ctx.validateOptions, ['OBJECT_PROPERTIES_MINIMUM'])) {
|
|
41
41
|
return;
|
|
42
42
|
}
|
|
43
43
|
if (!isObject(json)) {
|
|
@@ -59,9 +59,9 @@ export function minPropertiesValidator(this: ZSchemaBase, report: Report, schema
|
|
|
59
59
|
// required
|
|
60
60
|
// ---------------------------------------------------------------------------
|
|
61
61
|
|
|
62
|
-
export function requiredValidator(
|
|
62
|
+
export function requiredValidator(ctx: ZSchemaBase, report: Report, schema: JsonSchemaInternal, json: unknown) {
|
|
63
63
|
// http://json-schema.org/latest/json-schema-validation.html#rfc.section.5.4.3.2
|
|
64
|
-
if (shouldSkipValidate(
|
|
64
|
+
if (shouldSkipValidate(ctx.validateOptions, ['OBJECT_MISSING_REQUIRED_PROPERTY'])) {
|
|
65
65
|
return;
|
|
66
66
|
}
|
|
67
67
|
if (!isObject(json)) {
|
|
@@ -81,14 +81,14 @@ export function requiredValidator(this: ZSchemaBase, report: Report, schema: Jso
|
|
|
81
81
|
// ---------------------------------------------------------------------------
|
|
82
82
|
|
|
83
83
|
export function additionalPropertiesValidator(
|
|
84
|
-
|
|
84
|
+
ctx: ZSchemaBase,
|
|
85
85
|
report: Report,
|
|
86
86
|
schema: JsonSchemaInternal,
|
|
87
87
|
json: unknown
|
|
88
88
|
) {
|
|
89
89
|
// covered in properties and patternProperties
|
|
90
90
|
if (schema.properties === undefined && schema.patternProperties === undefined) {
|
|
91
|
-
|
|
91
|
+
propertiesValidator(ctx, report, schema, json);
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
|
|
@@ -97,14 +97,14 @@ export function additionalPropertiesValidator(
|
|
|
97
97
|
// ---------------------------------------------------------------------------
|
|
98
98
|
|
|
99
99
|
export function patternPropertiesValidator(
|
|
100
|
-
|
|
100
|
+
ctx: ZSchemaBase,
|
|
101
101
|
report: Report,
|
|
102
102
|
schema: JsonSchemaInternal,
|
|
103
103
|
json: unknown
|
|
104
104
|
) {
|
|
105
105
|
// covered in properties
|
|
106
106
|
if (schema.properties === undefined) {
|
|
107
|
-
|
|
107
|
+
propertiesValidator(ctx, report, schema, json);
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
|
|
@@ -112,16 +112,16 @@ export function patternPropertiesValidator(
|
|
|
112
112
|
// properties
|
|
113
113
|
// ---------------------------------------------------------------------------
|
|
114
114
|
|
|
115
|
-
export function propertiesValidator(
|
|
115
|
+
export function propertiesValidator(ctx: ZSchemaBase, report: Report, schema: JsonSchemaInternal, json: unknown) {
|
|
116
116
|
// http://json-schema.org/latest/json-schema-validation.html#rfc.section.5.4.4.2
|
|
117
|
-
if (shouldSkipValidate(
|
|
117
|
+
if (shouldSkipValidate(ctx.validateOptions, ['OBJECT_ADDITIONAL_PROPERTIES'])) {
|
|
118
118
|
return;
|
|
119
119
|
}
|
|
120
120
|
if (!isObject(json)) {
|
|
121
121
|
return;
|
|
122
122
|
}
|
|
123
|
-
const properties = schema.properties
|
|
124
|
-
const patternProperties = schema.patternProperties
|
|
123
|
+
const properties = schema.properties === undefined ? {} : schema.properties;
|
|
124
|
+
const patternProperties = schema.patternProperties === undefined ? {} : schema.patternProperties;
|
|
125
125
|
if (schema.additionalProperties === false) {
|
|
126
126
|
// The property set of the json to validate.
|
|
127
127
|
let s = Object.keys(json);
|
|
@@ -132,14 +132,15 @@ export function propertiesValidator(this: ZSchemaBase, report: Report, schema: J
|
|
|
132
132
|
// remove from "s" all elements of "p", if any;
|
|
133
133
|
s = difference(s, p);
|
|
134
134
|
// for each regex in "pp", remove all elements of "s" which this regex matches.
|
|
135
|
-
for (
|
|
135
|
+
for (let i = 0; i < pp.length; i++) {
|
|
136
|
+
const ppKey = pp[i];
|
|
136
137
|
const result = compileSchemaRegex(ppKey);
|
|
137
138
|
if (!result.ok) {
|
|
138
139
|
continue;
|
|
139
140
|
}
|
|
140
141
|
const regExp = result.value;
|
|
141
142
|
for (let idx2 = s.length - 1; idx2 >= 0; idx2--) {
|
|
142
|
-
if (regExp.test(s[idx2])
|
|
143
|
+
if (regExp.test(s[idx2])) {
|
|
143
144
|
s.splice(idx2, 1);
|
|
144
145
|
}
|
|
145
146
|
}
|
|
@@ -147,8 +148,8 @@ export function propertiesValidator(this: ZSchemaBase, report: Report, schema: J
|
|
|
147
148
|
// Validation of the json succeeds if, after these two steps, set "s" is empty.
|
|
148
149
|
if (s.length > 0) {
|
|
149
150
|
// assumeAdditional can be an array of allowed properties
|
|
150
|
-
if (Array.isArray(
|
|
151
|
-
for (const allowed of
|
|
151
|
+
if (Array.isArray(ctx.options.assumeAdditional)) {
|
|
152
|
+
for (const allowed of ctx.options.assumeAdditional) {
|
|
152
153
|
const io = s.indexOf(allowed);
|
|
153
154
|
if (io !== -1) {
|
|
154
155
|
s.splice(io, 1);
|
|
@@ -168,9 +169,9 @@ export function propertiesValidator(this: ZSchemaBase, report: Report, schema: J
|
|
|
168
169
|
// dependencies
|
|
169
170
|
// ---------------------------------------------------------------------------
|
|
170
171
|
|
|
171
|
-
export function dependenciesValidator(
|
|
172
|
+
export function dependenciesValidator(ctx: ZSchemaBase, report: Report, schema: JsonSchemaInternal, json: unknown) {
|
|
172
173
|
// http://json-schema.org/latest/json-schema-validation.html#rfc.section.5.4.5.2
|
|
173
|
-
if (shouldSkipValidate(
|
|
174
|
+
if (shouldSkipValidate(ctx.validateOptions, ['OBJECT_DEPENDENCY_KEY'])) {
|
|
174
175
|
return;
|
|
175
176
|
}
|
|
176
177
|
if (!isObject(json)) {
|
|
@@ -199,7 +200,7 @@ export function dependenciesValidator(this: ZSchemaBase, report: Report, schema:
|
|
|
199
200
|
}
|
|
200
201
|
} else {
|
|
201
202
|
// if dependency is a schema, validate against this schema
|
|
202
|
-
|
|
203
|
+
ctx._jsonValidate(report, dependencyDefinition, json);
|
|
203
204
|
}
|
|
204
205
|
}
|
|
205
206
|
}
|
|
@@ -209,13 +210,8 @@ export function dependenciesValidator(this: ZSchemaBase, report: Report, schema:
|
|
|
209
210
|
// dependentSchemas
|
|
210
211
|
// ---------------------------------------------------------------------------
|
|
211
212
|
|
|
212
|
-
export function dependentSchemasValidator(
|
|
213
|
-
|
|
214
|
-
report: Report,
|
|
215
|
-
schema: JsonSchemaInternal,
|
|
216
|
-
json: unknown
|
|
217
|
-
) {
|
|
218
|
-
if (!supportsDependentKeywords(schema, this.options.version)) {
|
|
213
|
+
export function dependentSchemasValidator(ctx: ZSchemaBase, report: Report, schema: JsonSchemaInternal, json: unknown) {
|
|
214
|
+
if (!supportsDependentKeywords(schema, ctx.options.version)) {
|
|
219
215
|
return;
|
|
220
216
|
}
|
|
221
217
|
if (!isObject(json) || !isObject(schema.dependentSchemas)) {
|
|
@@ -227,7 +223,7 @@ export function dependentSchemasValidator(
|
|
|
227
223
|
for (const dependencyName of keys) {
|
|
228
224
|
if (Object.hasOwn(json, dependencyName)) {
|
|
229
225
|
const dependencySchema = schema.dependentSchemas[dependencyName];
|
|
230
|
-
|
|
226
|
+
ctx._jsonValidate(report, dependencySchema, json);
|
|
231
227
|
}
|
|
232
228
|
}
|
|
233
229
|
}
|
|
@@ -237,15 +233,15 @@ export function dependentSchemasValidator(
|
|
|
237
233
|
// ---------------------------------------------------------------------------
|
|
238
234
|
|
|
239
235
|
export function dependentRequiredValidator(
|
|
240
|
-
|
|
236
|
+
ctx: ZSchemaBase,
|
|
241
237
|
report: Report,
|
|
242
238
|
schema: JsonSchemaInternal,
|
|
243
239
|
json: unknown
|
|
244
240
|
) {
|
|
245
|
-
if (!supportsDependentKeywords(schema,
|
|
241
|
+
if (!supportsDependentKeywords(schema, ctx.options.version)) {
|
|
246
242
|
return;
|
|
247
243
|
}
|
|
248
|
-
if (shouldSkipValidate(
|
|
244
|
+
if (shouldSkipValidate(ctx.validateOptions, ['OBJECT_DEPENDENCY_KEY'])) {
|
|
249
245
|
return;
|
|
250
246
|
}
|
|
251
247
|
if (!isObject(json) || !isObject(schema.dependentRequired)) {
|
|
@@ -282,8 +278,8 @@ export function dependentRequiredValidator(
|
|
|
282
278
|
// propertyNames
|
|
283
279
|
// ---------------------------------------------------------------------------
|
|
284
280
|
|
|
285
|
-
export function propertyNamesValidator(
|
|
286
|
-
if (shouldSkipValidate(
|
|
281
|
+
export function propertyNamesValidator(ctx: ZSchemaBase, report: Report, schema: JsonSchemaInternal, json: unknown) {
|
|
282
|
+
if (shouldSkipValidate(ctx.validateOptions, ['PROPERTY_NAMES'])) {
|
|
287
283
|
return;
|
|
288
284
|
}
|
|
289
285
|
|
|
@@ -302,13 +298,13 @@ export function propertyNamesValidator(this: ZSchemaBase, report: Report, schema
|
|
|
302
298
|
for (const key of keys) {
|
|
303
299
|
const subReport = new Report_(report);
|
|
304
300
|
subReports.push(subReport);
|
|
305
|
-
|
|
301
|
+
ctx._jsonValidate(subReport, propertyNamesSchema, key);
|
|
306
302
|
}
|
|
307
303
|
|
|
308
304
|
const addPropertyNameErrors = () => {
|
|
309
305
|
for (let idx = 0; idx < keys.length; idx++) {
|
|
310
306
|
if (subReports[idx].errors.length > 0) {
|
|
311
|
-
report.addError('PROPERTY_NAMES', [keys[idx]], subReports[idx], schema
|
|
307
|
+
report.addError('PROPERTY_NAMES', [keys[idx]], subReports[idx], schema);
|
|
312
308
|
}
|
|
313
309
|
}
|
|
314
310
|
};
|
package/src/validation/ref.ts
CHANGED
|
@@ -10,11 +10,11 @@ import { getRemotePath } from '../utils/uri.js';
|
|
|
10
10
|
export const getDynamicRefAnchorName = (dynamicRef: string) => {
|
|
11
11
|
const hashIdx = dynamicRef.indexOf('#');
|
|
12
12
|
if (hashIdx === -1) {
|
|
13
|
-
return
|
|
13
|
+
return;
|
|
14
14
|
}
|
|
15
15
|
const fragment = dynamicRef.slice(hashIdx + 1);
|
|
16
|
-
if (!fragment || fragment
|
|
17
|
-
return
|
|
16
|
+
if (!fragment || fragment.startsWith('/')) {
|
|
17
|
+
return;
|
|
18
18
|
}
|
|
19
19
|
return fragment;
|
|
20
20
|
};
|
|
@@ -26,7 +26,6 @@ export const findDynamicAnchorInScope = (scopeSchema: JsonSchemaInternal, anchor
|
|
|
26
26
|
if (found && found.$dynamicAnchor === anchorName) {
|
|
27
27
|
return found;
|
|
28
28
|
}
|
|
29
|
-
return undefined;
|
|
30
29
|
};
|
|
31
30
|
|
|
32
31
|
// ---------------------------------------------------------------------------
|
|
@@ -40,7 +39,7 @@ export const resolveRecursiveRef = (
|
|
|
40
39
|
schema: JsonSchemaInternal,
|
|
41
40
|
recursiveAnchorStack: JsonSchemaInternal[]
|
|
42
41
|
): JsonSchemaInternal | undefined => {
|
|
43
|
-
const resolved = schema.__$recursiveRefResolved
|
|
42
|
+
const resolved = schema.__$recursiveRefResolved;
|
|
44
43
|
if (!resolved) {
|
|
45
44
|
return undefined;
|
|
46
45
|
}
|
|
@@ -66,7 +65,7 @@ export const resolveDynamicRef = (
|
|
|
66
65
|
dynamicScopeStack: JsonSchemaInternal[]
|
|
67
66
|
): JsonSchemaInternal | boolean | undefined => {
|
|
68
67
|
const resolved = schema.__$dynamicRefResolved as JsonSchemaInternal | boolean | undefined;
|
|
69
|
-
if (
|
|
68
|
+
if (resolved === undefined || !schema.$dynamicRef) {
|
|
70
69
|
return resolved;
|
|
71
70
|
}
|
|
72
71
|
let target = resolved;
|