Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@stoplight/json-schema-ref-parser

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

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

Comparing version 9.2.2 to 9.2.3

18

lib/index.js

@@ -30,3 +30,3 @@ /* eslint-disable no-unused-vars */

*
* @constructor
* @class
*/

@@ -59,3 +59,3 @@ function $RefParser () {

* @param {$RefParserOptions} [options] - Options that determine how the schema is parsed
* @param {function} [callback] - An error-first callback. The second parameter is the parsed JSON schema object.
* @param {Function} [callback] - An error-first callback. The second parameter is the parsed JSON schema object.
* @returns {Promise} - The returned promise resolves with the parsed JSON schema object.

@@ -77,3 +77,3 @@ */

* @param {$RefParserOptions} [options] - Options that determine how the schema is parsed
* @param {function} [callback] - An error-first callback. The second parameter is the parsed JSON schema object.
* @param {Function} [callback] - An error-first callback. The second parameter is the parsed JSON schema object.
* @returns {Promise} - The returned promise resolves with the parsed JSON schema object.

@@ -158,3 +158,3 @@ */

* @param {$RefParserOptions} [options] - Options that determine how the schema is parsed and resolved
* @param {function} [callback]
* @param {Function} [callback]
* - An error-first callback. The second parameter is a {@link $Refs} object containing the resolved JSON references

@@ -178,3 +178,3 @@ *

* @param {$RefParserOptions} [options] - Options that determine how the schema is parsed and resolved
* @param {function} [callback]
* @param {Function} [callback]
* - An error-first callback. The second parameter is a {@link $Refs} object containing the resolved JSON references

@@ -208,3 +208,3 @@ *

* @param {$RefParserOptions} [options] - Options that determine how the schema is parsed, resolved, and dereferenced
* @param {function} [callback] - An error-first callback. The second parameter is the bundled JSON schema object
* @param {Function} [callback] - An error-first callback. The second parameter is the bundled JSON schema object
* @returns {Promise} - The returned promise resolves with the bundled JSON schema object.

@@ -226,3 +226,3 @@ */

* @param {$RefParserOptions} [options] - Options that determine how the schema is parsed, resolved, and dereferenced
* @param {function} [callback] - An error-first callback. The second parameter is the bundled JSON schema object
* @param {Function} [callback] - An error-first callback. The second parameter is the bundled JSON schema object
* @returns {Promise} - The returned promise resolves with the bundled JSON schema object.

@@ -252,3 +252,3 @@ */

* @param {$RefParserOptions} [options] - Options that determine how the schema is parsed, resolved, and dereferenced
* @param {function} [callback] - An error-first callback. The second parameter is the dereferenced JSON schema object
* @param {Function} [callback] - An error-first callback. The second parameter is the dereferenced JSON schema object
* @returns {Promise} - The returned promise resolves with the dereferenced JSON schema object.

@@ -269,3 +269,3 @@ */

* @param {$RefParserOptions} [options] - Options that determine how the schema is parsed, resolved, and dereferenced
* @param {function} [callback] - An error-first callback. The second parameter is the dereferenced JSON schema object
* @param {Function} [callback] - An error-first callback. The second parameter is the dereferenced JSON schema object
* @returns {Promise} - The returned promise resolves with the dereferenced JSON schema object.

@@ -272,0 +272,0 @@ */

@@ -17,3 +17,3 @@ /* eslint lines-around-comment: [2, {beforeBlockComment: false}] */

* @param {object|$RefParserOptions} [options] - Overridden options
* @constructor
* @class
*/

@@ -63,3 +63,3 @@ function $RefParserOptions (options) {

* that were encountered.
*/
*/
continueOnError: false,

@@ -137,3 +137,3 @@

* @param {*} val
* @returns {Boolean}
* @returns {boolean}
*/

@@ -140,0 +140,0 @@ function isMergeable (val) {

@@ -29,3 +29,3 @@ "use strict";

*
* @type {RegExp|string|string[]|function}
* @type {RegExp | string | string[] | Function}
*/

@@ -32,0 +32,0 @@ canParse: ".json",

@@ -30,3 +30,3 @@ "use strict";

*
* @type {RegExp|string[]|function}
* @type {RegExp | string[] | Function}
*/

@@ -33,0 +33,0 @@ canParse: [".yaml", ".yml", ".json"], // JSON is valid YAML

@@ -19,3 +19,3 @@ "use strict";

* @param {string} [friendlyPath] - The original user-specified path (used for error messages)
* @constructor
* @class
*/

@@ -25,2 +25,3 @@ function Pointer ($ref, path, friendlyPath) {

* The {@link $Ref} object that contains this {@link Pointer} object.
*
* @type {$Ref}

@@ -33,2 +34,3 @@ */

* This path is relative to the path of the main JSON schema file.
*
* @type {string}

@@ -40,2 +42,3 @@ */

* The original path or URL, used for error messages.
*
* @type {string}

@@ -48,2 +51,3 @@ */

* Can be any JSON type, not just objects. Unknown file types are represented as Buffers (byte arrays).
*
* @type {?*}

@@ -55,2 +59,3 @@ */

* Indicates whether the pointer references itself.
*
* @type {boolean}

@@ -63,2 +68,3 @@ */

* Resolving a single pointer may require resolving multiple $Refs.
*
* @type {number}

@@ -65,0 +71,0 @@ */

@@ -12,3 +12,3 @@ "use strict";

*
* @constructor
* @class
*/

@@ -31,2 +31,3 @@ function $Ref () {

* Can be any JSON type, not just objects. Unknown file types are represented as Buffers (byte arrays).
*
* @type {?*}

@@ -38,2 +39,3 @@ */

* The {@link $Refs} object that contains this {@link $Ref} object.
*
* @type {$Refs}

@@ -45,2 +47,3 @@ */

* Indicates the type of {@link $Ref#path} (e.g. "file", "http", etc.)
*
* @type {?string}

@@ -52,2 +55,3 @@ */

* List of all errors. Undefined if no errors.
*
* @type {Array<JSONParserError | ResolverError | ParserError | MissingPointerError>}

@@ -114,3 +118,3 @@ */

* @param {string} friendlyPath - The original user-specified path (used for error messages)
* @param {string} pathFromRoot - The path of `obj` from the schema root
* @param {string} pathFromRoot - The path of `obj` from the schema root
* @returns {Pointer}

@@ -117,0 +121,0 @@ */

@@ -84,3 +84,3 @@ "use strict";

return download(u, this, []);
}
},
};

@@ -103,2 +103,11 @@

// Certain implementations of `fetch` do not support URL based basic-auth
// Convert to headers
const headers = new Headers(httpOptions.headers);
if (u.auth && !headers.has("Authorization")) {
headers.set("Authorization", "Basic " + btoa(u.auth));
}
u = url.parse(url.format(Object.assign(u, { auth: "" })));
const controller = new AbortController();

@@ -109,7 +118,11 @@

method: "GET",
headers: httpOptions.headers || {},
headers: Object.fromEntries(headers.entries()),
credentials: httpOptions.withCredentials ? "include" : "omit",
signal: controller.signal,
// browser fetch API does not support redirects https://fetch.spec.whatwg.org/#atomic-http-redirect-handling
redirect: process.browser ? "follow" : httpOptions.redirects === 0 ? "error" : "manual",
redirect: process.browser
? "follow"
: httpOptions.redirects === 0
? "error"
: "manual",
};

@@ -130,4 +143,10 @@

if (redirects.length > httpOptions.redirects) {
throw new ResolverError(ono({ status: res.status },
`Error downloading ${redirects[0]}. \nToo many redirects: \n ${redirects.join(" \n ")}`));
throw new ResolverError(
ono(
{ status: res.status },
`Error downloading ${
redirects[0]
}. \nToo many redirects: \n ${redirects.join(" \n ")}`
)
);
}

@@ -137,3 +156,8 @@

if (!location) {
throw new ResolverError(ono({ status: res.status }, `HTTP ${res.status} redirect with no location header`));
throw new ResolverError(
ono(
{ status: res.status },
`HTTP ${res.status} redirect with no location header`
)
);
}

@@ -140,0 +164,0 @@

@@ -8,3 +8,3 @@ "use strict";

* @param {object} plugins - A map of plugin objects
* @return {object[]}
* @returns {object[]}
*/

@@ -28,3 +28,3 @@ exports.all = function (plugins) {

* @param {object} file - A file info object, which will be passed to each method
* @return {object[]}
* @returns {object[]}
*/

@@ -133,3 +133,3 @@ exports.filter = function (plugins, method, file) {

* @param {object} file - A file info object, which will be passed to the method
* @param {function} [callback] - A callback function, which will be passed to the method
* @param {Function} [callback] - A callback function, which will be passed to the method
* @returns {*}

@@ -136,0 +136,0 @@ */

@@ -13,16 +13,19 @@ "use strict";

// RegExp patterns to URL-encode special characters in local filesystem paths
let urlEncodePatterns = [
/\?/g, "%3F",
/\#/g, "%23",
];
let urlEncodePatterns = [/\?/g, "%3F", /\#/g, "%23"];
// RegExp patterns to URL-decode special characters for local filesystem paths
let urlDecodePatterns = [
/\%23/g, "#",
/\%24/g, "$",
/\%26/g, "&",
/\%2C/g, ",",
/\%40/g, "@"
/\%23/g,
"#",
/\%24/g,
"$",
/\%26/g,
"&",
/\%2C/g,
",",
/\%40/g,
"@",
];
exports.format = require("url").format;
exports.parse = require("url").parse;

@@ -273,5 +276,9 @@ exports.resolve = require("url").resolve;

return `#/${path.map(segment => {
return typeof segment === "number" ? String(segment) : segment.replace(tilde, "~0").replace(slash, "~1");
}).join("/")}`;
return `#/${path
.map((segment) => {
return typeof segment === "number"
? String(segment)
: segment.replace(tilde, "~0").replace(slash, "~1");
})
.join("/")}`;
};
{
"name": "@stoplight/json-schema-ref-parser",
"version": "9.2.2",
"version": "9.2.3",
"description": "Parse, Resolve, and Dereference JSON Schema $ref pointers",

@@ -28,3 +28,3 @@ "keywords": [

"type": "git",
"url": "https://github.com/APIDevTools/json-schema-ref-parser.git"
"url": "https://github.com/stoplightio/json-schema-ref-parser.git"
},

@@ -43,2 +43,3 @@ "license": "MIT",

"lint": "eslint lib test/fixtures test/specs",
"lint:fix": "eslint --fix lib test/fixtures test/specs",
"test": "npm run test:node && npm run test:typescript && npm run test:browser && npm run lint",

@@ -61,5 +62,7 @@ "test:node": "mocha",

"@jsdevtools/version-bump-prompt": "^6.1.0",
"@types/chai-spies": "^1.0.3",
"@types/json-schema": "^7.0.6",
"@types/node": "^14.14.21",
"chai": "^4.2.0",
"chai-spies": "^1.0.0",
"chai-subset": "^1.6.0",

@@ -66,0 +69,0 @@ "chokidar": "^3.5.1",

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