@apidevtools/json-schema-ref-parser
Advanced tools
Comparing version 9.0.9 to 9.1.0
@@ -44,4 +44,6 @@ "use strict"; | ||
let isExcludedPath = options.dereference.excludedPathMatcher; | ||
if (options.dereference.circular === "ignore" || !processedObjects.has(obj)) { | ||
if (obj && typeof obj === "object" && !ArrayBuffer.isView(obj)) { | ||
if (obj && typeof obj === "object" && !ArrayBuffer.isView(obj) && !isExcludedPath(pathFromRoot)) { | ||
parents.add(obj); | ||
@@ -59,2 +61,7 @@ processedObjects.add(obj); | ||
let keyPathFromRoot = Pointer.join(pathFromRoot, key); | ||
if (isExcludedPath(keyPathFromRoot)) { | ||
continue; | ||
} | ||
let value = obj[key]; | ||
@@ -61,0 +68,0 @@ let circular = false; |
@@ -234,2 +234,9 @@ import { JSONSchema4, JSONSchema4Type, JSONSchema6, JSONSchema6Type, JSONSchema7, JSONSchema7Type } from "json-schema"; | ||
circular?: boolean | "ignore"; | ||
/** | ||
* A function, called for each path, which can return true to stop this path and all | ||
* subpaths from being dereferenced further. This is useful in schemas where some | ||
* subpaths contain literal $ref keys that should not be dereferenced. | ||
*/ | ||
excludedPathMatcher?(path: string): boolean; | ||
}; | ||
@@ -236,0 +243,0 @@ } |
@@ -76,3 +76,12 @@ /* eslint lines-around-comment: [2, {beforeBlockComment: false}] */ | ||
*/ | ||
circular: true | ||
circular: true, | ||
/** | ||
* A function, called for each path, which can return true to stop this path and all | ||
* subpaths from being dereferenced further. This is useful in schemas where some | ||
* subpaths contain literal $ref keys that should not be dereferenced. | ||
* | ||
* @type {function} | ||
*/ | ||
excludedPathMatcher: () => false | ||
}, | ||
@@ -79,0 +88,0 @@ }; |
@@ -5,2 +5,3 @@ "use strict"; | ||
const yaml = require("js-yaml"); | ||
const { JSON_SCHEMA } = require("js-yaml"); | ||
@@ -49,3 +50,3 @@ module.exports = { | ||
try { | ||
return yaml.load(data); | ||
return yaml.load(data, { schema: JSON_SCHEMA }); | ||
} | ||
@@ -52,0 +53,0 @@ catch (e) { |
@@ -94,3 +94,3 @@ "use strict"; | ||
this.value = null; | ||
throw new MissingPointerError(token, this.originalPath); | ||
throw new MissingPointerError(token, decodeURI(this.originalPath)); | ||
} | ||
@@ -97,0 +97,0 @@ else { |
@@ -138,3 +138,3 @@ "use strict"; | ||
// but the issue is caused by the source file that referenced the file that undergoes dereferencing | ||
err.source = stripHash(pathFromRoot); | ||
err.source = decodeURI(stripHash(pathFromRoot)); | ||
} | ||
@@ -141,0 +141,0 @@ |
@@ -123,3 +123,3 @@ "use strict"; | ||
if ($refs._$refs[withoutHash]) { | ||
err.source = url.stripHash(path); | ||
err.source = decodeURI(url.stripHash(path)); | ||
err.path = url.safePointerToPath(url.getHash(path)); | ||
@@ -126,0 +126,0 @@ } |
{ | ||
"name": "@apidevtools/json-schema-ref-parser", | ||
"version": "9.0.9", | ||
"version": "9.1.0", | ||
"description": "Parse, Resolve, and Dereference JSON Schema $ref pointers", | ||
@@ -83,3 +83,4 @@ "keywords": [ | ||
"branches": [ | ||
"main" | ||
"main", | ||
"v9" | ||
], | ||
@@ -86,0 +87,0 @@ "plugins": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3156
139751
23
3