@hyperjump/json-schema
Advanced tools
Comparing version 0.17.1 to 0.17.2
const { Core, Schema } = require("@hyperjump/json-schema-core"); | ||
const { safeResolveUrl, splitUrl } = require("@hyperjump/json-schema-core/lib/common"); | ||
const { splitUrl } = require("@hyperjump/json-schema-core/lib/common"); | ||
const compile = (dynamicRef) => { | ||
const resolvedUri = safeResolveUrl(dynamicRef.id, Schema.value(dynamicRef)); | ||
return splitUrl(resolvedUri); | ||
const compile = async (dynamicRef, ast) => { | ||
const [, fragment] = splitUrl(Schema.value(dynamicRef)); | ||
const referencedSchema = await Schema.get(Schema.value(dynamicRef), dynamicRef); | ||
await Core.compileSchema(referencedSchema, ast); | ||
return [referencedSchema.id, fragment]; | ||
}; | ||
const interpret = ([id, fragment], instance, ast, dynamicAnchors) => { | ||
const schemaId = fragment in ast.metaData[id].dynamicAnchors ? dynamicAnchors[fragment] : id; | ||
const pointer = Schema.getAnchorPointer(ast.metaData[schemaId], fragment); | ||
return Core.interpretSchema(`${schemaId}#${pointer}`, instance, ast, dynamicAnchors); | ||
if (fragment in ast.metaData[id].dynamicAnchors) { | ||
return Core.interpretSchema(dynamicAnchors[fragment], instance, ast, dynamicAnchors); | ||
} else { | ||
const pointer = Schema.getAnchorPointer(ast.metaData[id], fragment); | ||
return Core.interpretSchema(`${id}#${encodeURI(pointer)}`, instance, ast, dynamicAnchors); | ||
} | ||
}; | ||
@@ -15,0 +20,0 @@ |
@@ -30,3 +30,3 @@ const { Keywords } = require("@hyperjump/json-schema-core"); | ||
maxProperties: require("./maxProperties"), | ||
maximumExclusiveMaximum: require("./maximum-exclusiveMaximum.js"), | ||
maximumExclusiveMaximum: require("./maximum-exclusiveMaximum"), | ||
maximum: require("./maximum"), | ||
@@ -33,0 +33,0 @@ metaData: Keywords.metaData, |
{ | ||
"name": "@hyperjump/json-schema", | ||
"version": "0.17.1", | ||
"version": "0.17.2", | ||
"description": "A JSON Schema Validator", | ||
@@ -43,5 +43,5 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"@hyperjump/json-schema-core": "^0.20.0", | ||
"@hyperjump/json-schema-core": "^0.21.0", | ||
"fastest-stable-stringify": "^2.0.2" | ||
} | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
4488220
27761
+ Added@hyperjump/json-schema-core@0.21.1(transitive)
- Removed@hyperjump/json-schema-core@0.20.2(transitive)