@hyperjump/json-schema 1.9.4 → 1.9.5
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.
|
@@ -16,11 +16,11 @@ export const annotation = (node, keyword, dialect = defaultDialectId) => {
|
|
|
16
16
|
const keywordUri = getKeywordId(keyword, dialect);
|
|
17
17
|
|
|
18
18
|
let currentNode = node.root;
|
|
19
|
-
const errors =
|
|
19
|
+
const errors = [...invalidSchemas(currentNode)];
|
|
20
20
|
for (let segment of JsonPointer.pointerSegments(node.pointer)) {
|
|
21
21
|
segment = segment === "-" && Instance.typeOf(currentNode) === "array" ? Instance.length(currentNode) : segment;
|
|
22
22
|
currentNode = Instance.step(segment, currentNode);
|
|
23
|
-
errors.push(...
|
|
23
|
+
errors.push(...invalidSchemas(currentNode));
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
const annotations = [];
|
|
@@ -33,6 +33,14 @@ export const annotation = (node, keyword, dialect = defaultDialectId) => {
|
|
|
33
33
|
return annotations;
|
|
34
34
|
};
|
|
35
35
|
|
|
36
|
+
const invalidSchemas = function* (node) {
|
|
37
|
+
for (const error in node.errors) {
|
|
38
|
+
if (node.errors[error] === "https://json-schema.org/evaluation/validate") {
|
|
39
|
+
yield error;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
|
|
36
44
|
export const annotatedWith = (instance, keyword, dialectId = defaultDialectId) => {
|
|
37
45
|
const nodes = [];
|
|
38
46
|
|
package/lib/keywords/if.js
CHANGED
|
@@ -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) => {
|
|
9
|
+
Validation.interpret(ifSchema, instance, ast, dynamicAnchors, true);
|
|
10
10
|
return true;
|
|
11
11
|
};
|
|
12
12
|
|
package/lib/output.js
CHANGED
|
@@ -25,7 +25,7 @@ outputFormats.BASIC = (instance) => {
|
|
|
25
25
|
|
|
26
26
|
for (const child of Instance.allNodes(instance)) {
|
|
27
27
|
for (const [absoluteKeywordLocation, keyword] of Object.entries(child.errors).reverse()) {
|
|
28
|
-
if (!child.valid) {
|
|
28
|
+
if (keyword !== "https://json-schema.org/evaluation/validate" && !child.valid) {
|
|
29
29
|
output.errors.unshift({
|
|
30
30
|
keyword,
|
|
31
31
|
absoluteKeywordLocation,
|
|
@@ -35,8 +35,6 @@ outputFormats.BASIC = (instance) => {
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
|
|
39
|
-
output.errors.pop();
|
|
40
38
|
}
|
|
41
39
|
|
|
42
40
|
return output;
|