@hyperjump/json-schema 1.2.5 → 1.2.6
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.
|
@@ -23,7 +23,16 @@ const interpret = ([numberOfItems, additionalItems], instance, ast, dynamicAncho
|
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
const collectEvaluatedItems = (keywordValue, instance, ast, dynamicAnchors) => {
|
|
26
|
-
|
|
26
|
+
if (!interpret(keywordValue, instance, ast, dynamicAnchors)) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const evaluatedIndexes = new Set();
|
|
31
|
+
for (let ndx = keywordValue[0]; ndx < Instance.length(instance); ndx++) {
|
|
32
|
+
evaluatedIndexes.add(ndx);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return evaluatedIndexes;
|
|
27
36
|
};
|
|
28
37
|
|
|
29
38
|
export default { id, compile, interpret, collectEvaluatedItems };
|
package/lib/keywords/items.js
CHANGED
|
@@ -8,8 +8,8 @@ const id = "https://json-schema.org/keyword/items";
|
|
|
8
8
|
|
|
9
9
|
const compile = async (schema, ast, parentSchema) => {
|
|
10
10
|
const prefixItemKeyword = getKeywordName(schema.dialectId, "https://json-schema.org/keyword/prefixItems");
|
|
11
|
-
const
|
|
12
|
-
const numberOfPrefixItems = Schema.typeOf(
|
|
11
|
+
const prefixItems = await Schema.step(prefixItemKeyword, parentSchema);
|
|
12
|
+
const numberOfPrefixItems = Schema.typeOf(prefixItems, "array") ? Schema.length(prefixItems) : 0;
|
|
13
13
|
|
|
14
14
|
return [numberOfPrefixItems, await Validation.compile(schema, ast)];
|
|
15
15
|
};
|
|
@@ -23,7 +23,16 @@ const interpret = ([numberOfPrefixItems, items], instance, ast, dynamicAnchors)
|
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
const collectEvaluatedItems = (keywordValue, instance, ast, dynamicAnchors) => {
|
|
26
|
-
|
|
26
|
+
if (!interpret(keywordValue, instance, ast, dynamicAnchors)) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const evaluatedIndexes = new Set();
|
|
31
|
+
for (let ndx = keywordValue[0]; ndx < Instance.length(instance); ndx++) {
|
|
32
|
+
evaluatedIndexes.add(ndx);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return evaluatedIndexes;
|
|
27
36
|
};
|
|
28
37
|
|
|
29
38
|
export default { id, compile, interpret, collectEvaluatedItems };
|
|
@@ -21,7 +21,18 @@ const interpret = ([schemaUrl, unevaluatedItems], instance, ast, dynamicAnchors)
|
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
const collectEvaluatedItems = (keywordValue, instance, ast, dynamicAnchors) => {
|
|
24
|
-
|
|
24
|
+
const itemIndexes = Validation.collectEvaluatedItems(keywordValue[0], instance, ast, dynamicAnchors, true);
|
|
25
|
+
if (!itemIndexes) {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const evaluatedIndexes = new Set();
|
|
30
|
+
for (let ndx = 0; ndx < Instance.length(instance); ndx++) {
|
|
31
|
+
if (!itemIndexes.has(ndx)) {
|
|
32
|
+
evaluatedIndexes.add(ndx);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return evaluatedIndexes;
|
|
25
36
|
};
|
|
26
37
|
|
|
27
38
|
export default { id, compile, interpret, collectEvaluatedItems };
|