@hyperjump/json-schema
Advanced tools
Comparing version 1.9.3 to 1.9.4
@@ -26,3 +26,3 @@ import type { Json } from "@hyperjump/json-pointer"; | ||
export const allNodes: (node) => Generator<JsonNode>; | ||
export const allNodes: (node: JsonNode) => Generator<JsonNode>; | ||
@@ -34,3 +34,3 @@ export type JsonNode = { | ||
children: JsonNode[]; | ||
parent: JsonNode; | ||
parent?: JsonNode; | ||
root: JsonNode; | ||
@@ -37,0 +37,0 @@ valid: boolean; |
@@ -121,3 +121,5 @@ import * as JsonPointer from "@hyperjump/json-pointer"; | ||
for (const property of node.children) { | ||
yield property.children[1]; | ||
if (property.children[1]) { | ||
yield property.children[1]; | ||
} | ||
} | ||
@@ -132,3 +134,5 @@ }; | ||
for (const property of node.children) { | ||
yield property.children; | ||
if (property.children.length === 2) { | ||
yield property.children; | ||
} | ||
} | ||
@@ -135,0 +139,0 @@ }; |
import * as Browser from "@hyperjump/browser"; | ||
import * as Instance from "../../annotations/annotated-instance.js"; | ||
import { pointerSegments } from "@hyperjump/json-pointer"; | ||
@@ -7,6 +8,10 @@ | ||
const compile = (schema) => Browser.value(schema); | ||
const compile = (schema) => { | ||
const keywordName = [...pointerSegments(schema.cursor)].pop(); | ||
return [keywordName, Browser.value(schema)]; | ||
}; | ||
const interpret = (value, instance, _ast, _dynamicAnchors, _quiet, schemaLocation) => { | ||
Instance.setAnnotation(instance, id, schemaLocation, value); | ||
const interpret = ([keywordName, value], instance, _ast, _dynamicAnchors, _quiet, schemaLocation) => { | ||
const keywordId = `${id}#${keywordName}`; | ||
Instance.setAnnotation(instance, keywordId, schemaLocation, value); | ||
return true; | ||
@@ -13,0 +18,0 @@ }; |
{ | ||
"name": "@hyperjump/json-schema", | ||
"version": "1.9.3", | ||
"version": "1.9.4", | ||
"description": "A JSON Schema validator with support for custom keywords, vocabularies, and dialects", | ||
@@ -5,0 +5,0 @@ "type": "module", |
Sorry, the diff of this file is not supported yet
327870
8978