@hyperjump/json-schema 1.3.0 → 1.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.
Files changed (39) hide show
  1. package/README.md +116 -5
  2. package/annotations/annotated-instance.d.ts +83 -0
  3. package/annotations/annotated-instance.js +50 -0
  4. package/annotations/index.d.ts +11 -0
  5. package/annotations/index.js +123 -0
  6. package/annotations/tests/applicators.json +375 -0
  7. package/annotations/tests/content.json +60 -0
  8. package/annotations/tests/core.json +33 -0
  9. package/annotations/tests/format.json +21 -0
  10. package/annotations/tests/meta-data.json +135 -0
  11. package/annotations/tests/unevaluated.json +557 -0
  12. package/annotations/tests/unknown.json +91 -0
  13. package/annotations/tests/validation.json +328 -0
  14. package/annotations/validation-error.d.ts +8 -0
  15. package/annotations/validation-error.js +7 -0
  16. package/bundle/index.js +2 -3
  17. package/lib/keywords/additionalProperties.js +19 -4
  18. package/lib/keywords/allOf.js +2 -2
  19. package/lib/keywords/anyOf.js +2 -2
  20. package/lib/keywords/contains.js +14 -14
  21. package/lib/keywords/contentSchema.js +7 -2
  22. package/lib/keywords/dependentSchemas.js +18 -8
  23. package/lib/keywords/dynamicRef.js +2 -2
  24. package/lib/keywords/else.js +12 -19
  25. package/lib/keywords/if.js +2 -2
  26. package/lib/keywords/items.js +3 -3
  27. package/lib/keywords/not.js +1 -1
  28. package/lib/keywords/oneOf.js +2 -2
  29. package/lib/keywords/patternProperties.js +20 -3
  30. package/lib/keywords/prefixItems.js +3 -3
  31. package/lib/keywords/properties.js +18 -6
  32. package/lib/keywords/propertyDependencies.js +2 -2
  33. package/lib/keywords/propertyNames.js +1 -1
  34. package/lib/keywords/then.js +12 -19
  35. package/lib/keywords/unevaluatedItems.js +2 -2
  36. package/lib/keywords/unevaluatedProperties.js +25 -5
  37. package/lib/keywords/validation.js +43 -53
  38. package/lib/keywords.js +1 -1
  39. package/package.json +4 -2
@@ -0,0 +1,328 @@
1
+ [
2
+ {
3
+ "title": "`const` doesn't produce annotations",
4
+ "schema": {
5
+ "const": "foo"
6
+ },
7
+ "subjects": [
8
+ {
9
+ "instance": "foo",
10
+ "assertions": [
11
+ {
12
+ "location": "#",
13
+ "keyword": "const",
14
+ "expected": []
15
+ }
16
+ ]
17
+ }
18
+ ]
19
+ },
20
+ {
21
+ "title": "`dependentRequired` doesn't produce annotations",
22
+ "schema": {
23
+ "dependentRequired": {
24
+ "foo": ["bar"]
25
+ }
26
+ },
27
+ "subjects": [
28
+ {
29
+ "instance": { "foo": 1, "bar": 2 },
30
+ "assertions": [
31
+ {
32
+ "location": "#",
33
+ "keyword": "dependentRequired",
34
+ "expected": []
35
+ }
36
+ ]
37
+ }
38
+ ]
39
+ },
40
+ {
41
+ "title": "`enum` doesn't produce annotations",
42
+ "schema": {
43
+ "enum": ["foo"]
44
+ },
45
+ "subjects": [
46
+ {
47
+ "instance": "foo",
48
+ "assertions": [
49
+ {
50
+ "location": "#",
51
+ "keyword": "enum",
52
+ "expected": []
53
+ }
54
+ ]
55
+ }
56
+ ]
57
+ },
58
+ {
59
+ "title": "`exclusiveMaximum` doesn't produce annotations",
60
+ "schema": {
61
+ "exclusiveMaximum": 50
62
+ },
63
+ "subjects": [
64
+ {
65
+ "instance": 42,
66
+ "assertions": [
67
+ {
68
+ "location": "#",
69
+ "keyword": "exclusiveMaximum",
70
+ "expected": []
71
+ }
72
+ ]
73
+ }
74
+ ]
75
+ },
76
+ {
77
+ "title": "`exclusiveMinimum` doesn't produce annotations",
78
+ "schema": {
79
+ "exclusiveMinimum": 5
80
+ },
81
+ "subjects": [
82
+ {
83
+ "instance": 42,
84
+ "assertions": [
85
+ {
86
+ "location": "#",
87
+ "keyword": "exclusiveMinimum",
88
+ "expected": []
89
+ }
90
+ ]
91
+ }
92
+ ]
93
+ },
94
+ {
95
+ "title": "`maxItems` doesn't produce annotations",
96
+ "schema": {
97
+ "maxItems": 42
98
+ },
99
+ "subjects": [
100
+ {
101
+ "instance": ["foo"],
102
+ "assertions": [
103
+ {
104
+ "location": "#",
105
+ "keyword": "maxItems",
106
+ "expected": []
107
+ }
108
+ ]
109
+ }
110
+ ]
111
+ },
112
+ {
113
+ "title": "`maxLength` doesn't produce annotations",
114
+ "schema": {
115
+ "maxLength": 42
116
+ },
117
+ "subjects": [
118
+ {
119
+ "instance": "foo",
120
+ "assertions": [
121
+ {
122
+ "location": "#",
123
+ "keyword": "maxLength",
124
+ "expected": []
125
+ }
126
+ ]
127
+ }
128
+ ]
129
+ },
130
+ {
131
+ "title": "`maxProperties` doesn't produce annotations",
132
+ "schema": {
133
+ "maxProperties": 42
134
+ },
135
+ "subjects": [
136
+ {
137
+ "instance": { "foo": 42 },
138
+ "assertions": [
139
+ {
140
+ "location": "#",
141
+ "keyword": "maxProperties",
142
+ "expected": []
143
+ }
144
+ ]
145
+ }
146
+ ]
147
+ },
148
+ {
149
+ "title": "`maximum` doesn't produce annotations",
150
+ "schema": {
151
+ "maximum": 50
152
+ },
153
+ "subjects": [
154
+ {
155
+ "instance": 42,
156
+ "assertions": [
157
+ {
158
+ "location": "#",
159
+ "keyword": "maximum",
160
+ "expected": []
161
+ }
162
+ ]
163
+ }
164
+ ]
165
+ },
166
+ {
167
+ "title": "`minItems` doesn't produce annotations",
168
+ "schema": {
169
+ "minItems": 2
170
+ },
171
+ "subjects": [
172
+ {
173
+ "instance": ["a", "b"],
174
+ "assertions": [
175
+ {
176
+ "location": "#",
177
+ "keyword": "minItems",
178
+ "expected": []
179
+ }
180
+ ]
181
+ }
182
+ ]
183
+ },
184
+ {
185
+ "title": "`minLength` doesn't produce annotations",
186
+ "schema": {
187
+ "minLength": 2
188
+ },
189
+ "subjects": [
190
+ {
191
+ "instance": "foo",
192
+ "assertions": [
193
+ {
194
+ "location": "#",
195
+ "keyword": "minLength",
196
+ "expected": []
197
+ }
198
+ ]
199
+ }
200
+ ]
201
+ },
202
+ {
203
+ "title": "`minProperties` doesn't produce annotations",
204
+ "schema": {
205
+ "minProperties": 2
206
+ },
207
+ "subjects": [
208
+ {
209
+ "instance": { "foo": 42, "bar": 24 },
210
+ "assertions": [
211
+ {
212
+ "location": "#",
213
+ "keyword": "minProperties",
214
+ "expected": []
215
+ }
216
+ ]
217
+ }
218
+ ]
219
+ },
220
+ {
221
+ "title": "`minimum` doesn't produce annotations",
222
+ "schema": {
223
+ "minimum": 42
224
+ },
225
+ "subjects": [
226
+ {
227
+ "instance": 50,
228
+ "assertions": [
229
+ {
230
+ "location": "#",
231
+ "keyword": "minimum",
232
+ "expected": []
233
+ }
234
+ ]
235
+ }
236
+ ]
237
+ },
238
+ {
239
+ "title": "`multipleOf` doesn't produce annotations",
240
+ "schema": {
241
+ "multipleOf": 2
242
+ },
243
+ "subjects": [
244
+ {
245
+ "instance": 42,
246
+ "assertions": [
247
+ {
248
+ "location": "#",
249
+ "keyword": "multipleOf",
250
+ "expected": []
251
+ }
252
+ ]
253
+ }
254
+ ]
255
+ },
256
+ {
257
+ "title": "`pattern` doesn't produce annotations",
258
+ "schema": {
259
+ "pattern": ".*"
260
+ },
261
+ "subjects": [
262
+ {
263
+ "instance": "foo",
264
+ "assertions": [
265
+ {
266
+ "location": "#",
267
+ "keyword": "pattern",
268
+ "expected": []
269
+ }
270
+ ]
271
+ }
272
+ ]
273
+ },
274
+ {
275
+ "title": "`required` doesn't produce annotations",
276
+ "schema": {
277
+ "required": ["foo"]
278
+ },
279
+ "subjects": [
280
+ {
281
+ "instance": { "foo": 42 },
282
+ "assertions": [
283
+ {
284
+ "location": "#",
285
+ "keyword": "required",
286
+ "expected": []
287
+ }
288
+ ]
289
+ }
290
+ ]
291
+ },
292
+ {
293
+ "title": "`type` doesn't produce annotations",
294
+ "schema": {
295
+ "type": "string"
296
+ },
297
+ "subjects": [
298
+ {
299
+ "instance": "foo",
300
+ "assertions": [
301
+ {
302
+ "location": "#",
303
+ "keyword": "type",
304
+ "expected": []
305
+ }
306
+ ]
307
+ }
308
+ ]
309
+ },
310
+ {
311
+ "title": "`uniqueItems` doesn't produce annotations",
312
+ "schema": {
313
+ "uniqueItems": true
314
+ },
315
+ "subjects": [
316
+ {
317
+ "instance": ["foo", "bar"],
318
+ "assertions": [
319
+ {
320
+ "location": "#",
321
+ "keyword": "uniqueItems",
322
+ "expected": []
323
+ }
324
+ ]
325
+ }
326
+ ]
327
+ }
328
+ ]
@@ -0,0 +1,8 @@
1
+ import type { OutputUnit } from "../lib/core.js";
2
+
3
+
4
+ export class ValidationError extends Error {
5
+ public output: OutputUnit;
6
+
7
+ public constructor(output: OutputUnit);
8
+ }
@@ -0,0 +1,7 @@
1
+ export class ValidationError extends Error {
2
+ constructor(output) {
3
+ super("Validation Error");
4
+ this.name = this.constructor.name;
5
+ this.output = output;
6
+ }
7
+ }
package/bundle/index.js CHANGED
@@ -70,14 +70,13 @@ const collectExternalIds = async (uri, options) => {
70
70
  };
71
71
 
72
72
  Validation.collectExternalIds = (schemaUri, externalIds, ast, dynamicAnchors) => {
73
- const nodes = ast[schemaUri][2];
74
- if (externalIds.has(schemaUri) || typeof nodes === "boolean") {
73
+ if (externalIds.has(schemaUri) || typeof ast[schemaUri] === "boolean") {
75
74
  return;
76
75
  }
77
76
  externalIds.add(schemaUri);
78
77
 
79
78
  const id = toAbsoluteUri(schemaUri);
80
- for (const [keywordId, , keywordValue] of nodes) {
79
+ for (const [keywordId, , keywordValue] of ast[schemaUri]) {
81
80
  const keyword = getKeyword(keywordId);
82
81
 
83
82
  if (keyword.collectExternalIds) {
@@ -18,18 +18,33 @@ const compile = async (schema, ast, parentSchema) => {
18
18
  return [propertyNames, propertyNamePatterns, await Validation.compile(schema, ast)];
19
19
  };
20
20
 
21
- const interpret = ([propertyNames, propertyNamePatterns, additionalProperties], instance, ast, dynamicAnchors) => {
21
+ const interpret = ([propertyNames, propertyNamePatterns, additionalProperties], instance, ast, dynamicAnchors, quiet) => {
22
22
  if (!Instance.typeOf(instance, "object")) {
23
23
  return true;
24
24
  }
25
25
 
26
26
  return Instance.entries(instance)
27
27
  .filter(([propertyName]) => !propertyNames.includes(propertyName) && !propertyNamePatterns.some((pattern) => pattern.test(propertyName)))
28
- .every(([, property]) => Validation.interpret(additionalProperties, property, ast, dynamicAnchors));
28
+ .every(([, property]) => Validation.interpret(additionalProperties, property, ast, dynamicAnchors, quiet));
29
29
  };
30
30
 
31
- const collectEvaluatedProperties = (keywordValue, instance, ast, dynamicAnchors) => {
32
- return interpret(keywordValue, instance, ast, dynamicAnchors) && [new RegExp("")];
31
+ const collectEvaluatedProperties = ([propertyNames, propertyNamePatterns, additionalProperties], instance, ast, dynamicAnchors) => {
32
+ if (!Instance.typeOf(instance, "object")) {
33
+ return true;
34
+ }
35
+
36
+ const evaluatedPropertyNames = new Set();
37
+ for (const [propertyName, property] of Instance.entries(instance)) {
38
+ if (!propertyNames.includes(propertyName) && !propertyNamePatterns.some((pattern) => pattern.test(propertyName))) {
39
+ if (!Validation.interpret(additionalProperties, property, ast, dynamicAnchors, true)) {
40
+ return false;
41
+ }
42
+
43
+ evaluatedPropertyNames.add(propertyName);
44
+ }
45
+ }
46
+
47
+ return evaluatedPropertyNames;
33
48
  };
34
49
 
35
50
  export default { id, compile, interpret, collectEvaluatedProperties };
@@ -10,8 +10,8 @@ const compile = (schema, ast) => Pact.pipeline([
10
10
  Pact.all
11
11
  ], schema);
12
12
 
13
- const interpret = (allOf, instance, ast, dynamicAnchors) => {
14
- return allOf.every((schemaUrl) => Validation.interpret(schemaUrl, instance, ast, dynamicAnchors));
13
+ const interpret = (allOf, instance, ast, dynamicAnchors, quiet) => {
14
+ return allOf.every((schemaUrl) => Validation.interpret(schemaUrl, instance, ast, dynamicAnchors, quiet));
15
15
  };
16
16
 
17
17
  const collectEvaluatedProperties = (allOf, instance, ast, dynamicAnchors) => {
@@ -10,8 +10,8 @@ const compile = (schema, ast) => Pact.pipeline([
10
10
  Pact.all
11
11
  ], schema);
12
12
 
13
- const interpret = (anyOf, instance, ast, dynamicAnchors) => {
14
- const matches = anyOf.filter((schemaUrl) => Validation.interpret(schemaUrl, instance, ast, dynamicAnchors));
13
+ const interpret = (anyOf, instance, ast, dynamicAnchors, quiet) => {
14
+ const matches = anyOf.filter((schemaUrl) => Validation.interpret(schemaUrl, instance, ast, dynamicAnchors, quiet));
15
15
  return matches.length > 0;
16
16
  };
17
17
 
@@ -20,34 +20,34 @@ const compile = async (schema, ast, parentSchema) => {
20
20
  return { contains, minContains, maxContains };
21
21
  };
22
22
 
23
- const interpret = ({ contains, minContains, maxContains }, instance, ast, dynamicAnchors) => {
23
+ const interpret = ({ contains, minContains, maxContains }, instance, ast, dynamicAnchors, quiet) => {
24
24
  if (!Instance.typeOf(instance, "array") && !Instance.typeOf(instance, "object")) {
25
25
  return true;
26
26
  }
27
27
 
28
28
  const matches = Instance.entries(instance).reduce((matches, [, item]) => {
29
- return Validation.interpret(contains, item, ast, dynamicAnchors) ? matches + 1 : matches;
29
+ return Validation.interpret(contains, item, ast, dynamicAnchors, quiet) ? matches + 1 : matches;
30
30
  }, 0);
31
31
  return matches >= minContains && matches <= maxContains;
32
32
  };
33
33
 
34
- const collectEvaluatedItems = (keywordValue, instance, ast, dynamicAnchors) => {
35
- return interpret(keywordValue, instance, ast, dynamicAnchors)
36
- && Instance.typeOf(instance, "array")
37
- && Instance.reduce((matchedIndexes, item, itemIndex) => {
38
- return Validation.interpret(keywordValue.contains, item, ast, dynamicAnchors) ? matchedIndexes.add(itemIndex) : matchedIndexes;
39
- }, new Set(), instance);
40
- };
41
-
42
34
  const collectEvaluatedProperties = (keywordValue, instance, ast, dynamicAnchors) => {
43
- return interpret(keywordValue, instance, ast, dynamicAnchors)
35
+ return interpret(keywordValue, instance, ast, dynamicAnchors, true)
44
36
  && Instance.typeOf(instance, "object")
45
37
  && Instance.entries(instance).reduce((matchedPropertyNames, [propertyName, item]) => {
46
- if (Validation.interpret(keywordValue.contains, item, ast, dynamicAnchors)) {
47
- matchedPropertyNames.push(propertyName);
38
+ if (Validation.interpret(keywordValue.contains, item, ast, dynamicAnchors, true)) {
39
+ matchedPropertyNames.add(propertyName);
48
40
  }
49
41
  return matchedPropertyNames;
50
- }, [], instance);
42
+ }, new Set(), instance);
43
+ };
44
+
45
+ const collectEvaluatedItems = (keywordValue, instance, ast, dynamicAnchors) => {
46
+ return interpret(keywordValue, instance, ast, dynamicAnchors, true)
47
+ && Instance.typeOf(instance, "array")
48
+ && Instance.reduce((matchedIndexes, item, itemIndex) => {
49
+ return Validation.interpret(keywordValue.contains, item, ast, dynamicAnchors, true) ? matchedIndexes.add(itemIndex) : matchedIndexes;
50
+ }, new Set(), instance);
51
51
  };
52
52
 
53
53
  export default { id, compile, interpret, collectEvaluatedItems, collectEvaluatedProperties };
@@ -1,4 +1,9 @@
1
- import metaData from "./meta-data.js";
1
+ import * as Schema from "../schema.js";
2
2
 
3
3
 
4
- export default { id: "https://json-schema.org/keyword/contentSchema", ...metaData };
4
+ const id = "https://json-schema.org/keyword/contentSchema";
5
+
6
+ const compile = (contentSchema) => Schema.uri(contentSchema);
7
+ const interpret = () => true;
8
+
9
+ export default { id, compile, interpret };
@@ -12,23 +12,33 @@ const compile = (schema, ast) => Pact.pipeline([
12
12
  Pact.all
13
13
  ], schema);
14
14
 
15
- const interpret = (dependentSchemas, instance, ast, dynamicAnchors) => {
15
+ const interpret = (dependentSchemas, instance, ast, dynamicAnchors, quiet) => {
16
16
  const value = Instance.value(instance);
17
17
 
18
18
  return !Instance.typeOf(instance, "object") || dependentSchemas.every(([propertyName, dependentSchema]) => {
19
- return !(propertyName in value) || Validation.interpret(dependentSchema, instance, ast, dynamicAnchors);
19
+ return !(propertyName in value) || Validation.interpret(dependentSchema, instance, ast, dynamicAnchors, quiet);
20
20
  });
21
21
  };
22
22
 
23
23
  const collectEvaluatedProperties = (dependentSchemas, instance, ast, dynamicAnchors) => {
24
- return dependentSchemas.reduce((acc, [propertyName, dependentSchema]) => {
25
- if (!acc || !Instance.has(propertyName, instance)) {
26
- return acc;
24
+ const value = Instance.value(instance);
25
+ if (!Instance.typeOf(instance, "object")) {
26
+ return false;
27
+ }
28
+
29
+ const evaluatedPropertyNames = new Set();
30
+ for (const [propertyName, dependentSchema] of dependentSchemas) {
31
+ if (propertyName in value) {
32
+ const propertyNames = Validation.collectEvaluatedProperties(dependentSchema, instance, ast, dynamicAnchors);
33
+ if (propertyNames === false) {
34
+ return false;
35
+ }
36
+
37
+ propertyNames.forEach(Set.prototype.add.bind(evaluatedPropertyNames));
27
38
  }
39
+ }
28
40
 
29
- const propertyNames = Validation.collectEvaluatedProperties(dependentSchema, instance, ast, dynamicAnchors);
30
- return propertyNames !== false && acc.concat(propertyNames);
31
- }, []);
41
+ return evaluatedPropertyNames;
32
42
  };
33
43
 
34
44
  export default { id, compile, interpret, collectEvaluatedProperties };
@@ -7,11 +7,11 @@ const experimental = true;
7
7
 
8
8
  const compile = Schema.value;
9
9
 
10
- const interpret = (fragment, instance, ast, dynamicAnchors) => {
10
+ const interpret = (fragment, instance, ast, dynamicAnchors, quiet) => {
11
11
  if (!(fragment in dynamicAnchors)) {
12
12
  throw Error(`No dynamic anchor found for "${fragment}"`);
13
13
  }
14
- return Validation.interpret(dynamicAnchors[fragment], instance, ast, dynamicAnchors);
14
+ return Validation.interpret(dynamicAnchors[fragment], instance, ast, dynamicAnchors, quiet);
15
15
  };
16
16
 
17
17
  const collectEvaluatedProperties = Validation.collectEvaluatedProperties;
@@ -1,5 +1,5 @@
1
1
  import * as Schema from "../schema.js";
2
- import { getKeywordName, getKeyword } from "../keywords.js";
2
+ import { getKeywordName } from "../keywords.js";
3
3
  import Validation from "./validation.js";
4
4
 
5
5
 
@@ -15,33 +15,26 @@ const compile = async (schema, ast, parentSchema) => {
15
15
  }
16
16
  };
17
17
 
18
- const interpret = ([guard, block], instance, ast, dynamicAnchors) => {
19
- return guard === undefined || quietInterpretSchema(guard, instance, ast, dynamicAnchors) || Validation.interpret(block, instance, ast, dynamicAnchors);
18
+ const interpret = ([ifSchema, elseSchema], instance, ast, dynamicAnchors, quiet) => {
19
+ return ifSchema === undefined
20
+ || Validation.interpret(ifSchema, instance, ast, dynamicAnchors, true)
21
+ || Validation.interpret(elseSchema, instance, ast, dynamicAnchors, quiet);
20
22
  };
21
23
 
22
- // Interpret a schema without events being emitted
23
- const quietInterpretSchema = (url, instance, ast, dynamicAnchors) => {
24
- const nodes = ast[url][2];
25
-
26
- return typeof nodes === "boolean" ? nodes : nodes.every(([keywordId, , keywordValue]) => {
27
- return getKeyword(keywordId).interpret(keywordValue, instance, ast, dynamicAnchors);
28
- });
29
- };
30
-
31
- const collectEvaluatedProperties = ([guard, block], instance, ast, dynamicAnchors) => {
32
- if (guard === undefined || quietInterpretSchema(guard, instance, ast, dynamicAnchors)) {
33
- return [];
24
+ const collectEvaluatedProperties = ([ifSchema, elseSchema], instance, ast, dynamicAnchors) => {
25
+ if (ifSchema === undefined || Validation.interpret(ifSchema, instance, ast, dynamicAnchors, true)) {
26
+ return new Set();
34
27
  }
35
28
 
36
- return Validation.collectEvaluatedProperties(block, instance, ast, dynamicAnchors);
29
+ return Validation.collectEvaluatedProperties(elseSchema, instance, ast, dynamicAnchors);
37
30
  };
38
31
 
39
- const collectEvaluatedItems = ([guard, block], instance, ast, dynamicAnchors) => {
40
- if (guard === undefined || quietInterpretSchema(guard, instance, ast, dynamicAnchors)) {
32
+ const collectEvaluatedItems = ([ifSchema, elseSchema], instance, ast, dynamicAnchors) => {
33
+ if (ifSchema === undefined || Validation.interpret(ifSchema, instance, ast, dynamicAnchors, true)) {
41
34
  return new Set();
42
35
  }
43
36
 
44
- return Validation.collectEvaluatedItems(block, instance, ast, dynamicAnchors);
37
+ return Validation.collectEvaluatedItems(elseSchema, instance, ast, dynamicAnchors);
45
38
  };
46
39
 
47
40
  export default { id, compile, interpret, collectEvaluatedProperties, collectEvaluatedItems };
@@ -5,8 +5,8 @@ const id = "https://json-schema.org/keyword/if";
5
5
 
6
6
  const compile = (schema, ast) => Validation.compile(schema, ast);
7
7
 
8
- const interpret = (ifSchema, instance, ast, dynamicAnchors) => {
9
- Validation.interpret(ifSchema, instance, ast, dynamicAnchors);
8
+ const interpret = (ifSchema, instance, ast, dynamicAnchors, quiet) => {
9
+ Validation.interpret(ifSchema, instance, ast, dynamicAnchors, quiet);
10
10
  return true;
11
11
  };
12
12
 
@@ -14,16 +14,16 @@ const compile = async (schema, ast, parentSchema) => {
14
14
  return [numberOfPrefixItems, await Validation.compile(schema, ast)];
15
15
  };
16
16
 
17
- const interpret = ([numberOfPrefixItems, items], instance, ast, dynamicAnchors) => {
17
+ const interpret = ([numberOfPrefixItems, items], instance, ast, dynamicAnchors, quiet) => {
18
18
  if (!Instance.typeOf(instance, "array")) {
19
19
  return true;
20
20
  }
21
21
 
22
- return Instance.every((item, ndx) => ndx < numberOfPrefixItems || Validation.interpret(items, item, ast, dynamicAnchors), instance);
22
+ return Instance.every((item, ndx) => ndx < numberOfPrefixItems || Validation.interpret(items, item, ast, dynamicAnchors, quiet), instance);
23
23
  };
24
24
 
25
25
  const collectEvaluatedItems = (keywordValue, instance, ast, dynamicAnchors) => {
26
- if (!interpret(keywordValue, instance, ast, dynamicAnchors)) {
26
+ if (!interpret(keywordValue, instance, ast, dynamicAnchors, true)) {
27
27
  return false;
28
28
  }
29
29
 
@@ -4,6 +4,6 @@ import Validation from "./validation.js";
4
4
  const id = "https://json-schema.org/keyword/not";
5
5
 
6
6
  const compile = Validation.compile;
7
- const interpret = (not, instance, ast, dynamicAnchors) => !Validation.interpret(not, instance, ast, dynamicAnchors);
7
+ const interpret = (not, instance, ast, dynamicAnchors, quiet) => !Validation.interpret(not, instance, ast, dynamicAnchors, quiet);
8
8
 
9
9
  export default { id, compile, interpret };
@@ -9,10 +9,10 @@ const compile = async (schema, ast) => {
9
9
  return Promise.all(oneOf);
10
10
  };
11
11
 
12
- const interpret = (oneOf, instance, ast, dynamicAnchors) => {
12
+ const interpret = (oneOf, instance, ast, dynamicAnchors, quiet) => {
13
13
  let validCount = 0;
14
14
  for (const schemaUrl of oneOf) {
15
- if (Validation.interpret(schemaUrl, instance, ast, dynamicAnchors)) {
15
+ if (Validation.interpret(schemaUrl, instance, ast, dynamicAnchors, quiet)) {
16
16
  validCount++;
17
17
  }
18
18