Socket
Socket
Sign inDemoInstall

@apidevtools/json-schema-ref-parser

Package Overview
Dependencies
Maintainers
2
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@apidevtools/json-schema-ref-parser - npm Package Compare versions

Comparing version 9.0.9 to 9.1.0

9

lib/dereference.js

@@ -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 @@ };

3

lib/parsers/yaml.js

@@ -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": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc