@hyperjump/json-schema 1.9.5 → 1.9.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.
package/lib/core.js CHANGED
@@ -43,7 +43,7 @@ subscribe("validate.metaValidate", async (_message, schema) => {
43
43
 
44
44
  // Compile
45
45
  if (!(schema.document.dialectId in metaValidators)) {
46
- const metaSchema = await getSchema(schema.document.dialectId);
46
+ const metaSchema = await getSchema(schema.document.dialectId, schema);
47
47
  const compiledSchema = await compile(metaSchema);
48
48
  metaValidators[schema.document.dialectId] = interpret(compiledSchema);
49
49
  }
package/lib/instance.js CHANGED
@@ -76,10 +76,6 @@ export const typeOf = (node) => node.type;
76
76
  export const has = (key, node) => key in node.value;
77
77
 
78
78
  export const step = (key, node) => {
79
- if (node.type !== "object" && node.type !== "array") {
80
- return;
81
- }
82
-
83
79
  switch (node.type) {
84
80
  case "object":
85
81
  const property = node.children.find((propertyNode) => {
package/lib/schema.js CHANGED
@@ -22,13 +22,15 @@ const schemaRegistry = {};
22
22
  export const getSchema = async (uri, browser = undefined) => {
23
23
  if (!browser) {
24
24
  browser = { _cache: {} };
25
+ }
25
26
 
26
- for (const uri in schemaRegistry) {
27
+ for (const uri in schemaRegistry) {
28
+ if (!(uri in browser._cache)) {
27
29
  browser._cache[uri] = schemaRegistry[uri];
28
30
  }
29
31
  }
30
32
 
31
- const schema = await browserGet(uri, browser);
33
+ const schema = await browserGet(uri, { ...browser });
32
34
  if (typeof schema.document.dialectId !== "string") {
33
35
  throw Error(`The document at ${schema.document.baseUri} is not a schema.`);
34
36
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperjump/json-schema",
3
- "version": "1.9.5",
3
+ "version": "1.9.6",
4
4
  "description": "A JSON Schema validator with support for custom keywords, vocabularies, and dialects",
5
5
  "type": "module",
6
6
  "main": "./stable/index.js",