@hyperjump/json-schema 1.9.3 → 1.9.4
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/LICENSE +1 -1
- package/lib/instance.d.ts +2 -2
- package/lib/instance.js +6 -2
- package/lib/keywords/unknown.js +8 -3
- package/package.json +1 -1
package/LICENSE
CHANGED
package/lib/instance.d.ts
CHANGED
|
@@ -23,14 +23,14 @@ export const values: (node: JsonNode) => Generator<JsonNode>;
|
|
|
23
23
|
export const entries: (node: JsonNode) => Generator<[JsonNode, JsonNode]>;
|
|
24
24
|
export const length: (node: JsonNode) => number;
|
|
25
25
|
|
|
26
|
-
export const allNodes: (node) => Generator<JsonNode>;
|
|
26
|
+
export const allNodes: (node: JsonNode) => Generator<JsonNode>;
|
|
27
27
|
|
|
28
28
|
export type JsonNode = {
|
|
29
29
|
baseUri: string;
|
|
30
30
|
pointer: string;
|
|
31
31
|
type: JsonNodeType;
|
|
32
32
|
children: JsonNode[];
|
|
33
|
-
parent
|
|
33
|
+
parent?: JsonNode;
|
|
34
34
|
root: JsonNode;
|
|
35
35
|
valid: boolean;
|
|
36
36
|
errors: Record<string, string>;
|
package/lib/instance.js
CHANGED
|
@@ -118,7 +118,9 @@ export const values = function* (node) {
|
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
for (const property of node.children) {
|
|
121
|
-
|
|
121
|
+
if (property.children[1]) {
|
|
122
|
+
yield property.children[1];
|
|
123
|
+
}
|
|
122
124
|
}
|
|
123
125
|
};
|
|
124
126
|
|
|
@@ -128,7 +130,9 @@ export const entries = function* (node) {
|
|
|
128
130
|
}
|
|
129
131
|
|
|
130
132
|
for (const property of node.children) {
|
|
131
|
-
|
|
133
|
+
if (property.children.length === 2) {
|
|
134
|
+
yield property.children;
|
|
135
|
+
}
|
|
132
136
|
}
|
|
133
137
|
};
|
|
134
138
|
|
package/lib/keywords/unknown.js
CHANGED
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import * as Browser from "@hyperjump/browser";
|
|
2
2
|
import * as Instance from "../../annotations/annotated-instance.js";
|
|
3
|
+
import { pointerSegments } from "@hyperjump/json-pointer";
|
|
3
4
|
|
|
4
5
|
|
|
5
6
|
const id = "https://json-schema.org/keyword/unknown";
|
|
6
7
|
|
|
7
|
-
const compile = (schema) =>
|
|
8
|
+
const compile = (schema) => {
|
|
9
|
+
const keywordName = [...pointerSegments(schema.cursor)].pop();
|
|
10
|
+
return [keywordName, Browser.value(schema)];
|
|
11
|
+
};
|
|
8
12
|
|
|
9
|
-
const interpret = (value, instance, _ast, _dynamicAnchors, _quiet, schemaLocation) => {
|
|
10
|
-
|
|
13
|
+
const interpret = ([keywordName, value], instance, _ast, _dynamicAnchors, _quiet, schemaLocation) => {
|
|
14
|
+
const keywordId = `${id}#${keywordName}`;
|
|
15
|
+
Instance.setAnnotation(instance, keywordId, schemaLocation, value);
|
|
11
16
|
return true;
|
|
12
17
|
};
|
|
13
18
|
|