New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@stoplight/json-schema-ref-parser

Package Overview
Dependencies
Maintainers
22
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

to
9.1.3-beta.2

36

lib/bundle/index.js

@@ -137,2 +137,4 @@ "use strict";

let mappedPathFromRoot = pathFromRoot;
let existingEntry = findInInventory(inventory, $refParent, $refKey);

@@ -158,4 +160,3 @@ if (existingEntry) {

pathFromRoot = findClosestRoot(customRoots[file], hash, pathFromRoot);
depth = Pointer.parse(pathFromRoot).length;
mappedPathFromRoot = findClosestRoot(customRoots[file], hash, pathFromRoot);
}

@@ -168,2 +169,3 @@

pathFromRoot, // The path to the $ref pointer, from the JSON Schema root
mappedPathFromRoot, // The path to the $ref pointer after custom root applied
depth, // How far from the JSON Schema root is this $ref pointer?

@@ -258,13 +260,13 @@ file, // The file that the $ref pointer resolves to

// console.log('Re-mapping $ref pointer "%s" at %s', entry.$ref.$ref, entry.pathFromRoot);
// if entry is not inlineable and has a custom root linked, we need to remap the properties of the object
if (customRoots[entry.file] && entry.hash in customRoots[entry.file] && typeof customRoots[entry.file]["#"] === "string") {
if (entry.hash === "#") {
// if entry is not dinlineable and has a custom root linked, we need to remap the properties of the object
if (customRoots[entry.file] && customRoots[entry.file][entry.hash] !== null) {
if (entry.hash === "#" || !("#" in customRoots[entry.file])) {
// the whole file is referenced for the first time
// we need to inject its entire content here
set(schema, customRoots[entry.file]["#"], $Ref.dereference(entry.$ref, entry.value));
entry.$ref.$ref = customRoots[entry.file]["#"];
// or only certain fragment of the whole file has a custom root and we need to inject that portion
set(schema, customRoots[entry.file][entry.hash], $Ref.dereference(entry.$ref, entry.value));
entry.$ref.$ref = customRoots[entry.file][entry.hash];
}
// entry is not supposed to be moved anywhere, it's not placed under root
else if (customRoots[entry.file][entry.hash] !== null) {
else {
// a portion of previously referenced (and injected) file is referenced

@@ -283,7 +285,7 @@ // we may need to hoist some of its properties, i.e. `external-file.json#/definitions/foo/definitions/bar` gets remapped to `#/definitions/foo_bar`

delete value[parsedHash[parsedHash.length - 1]];
entry.$ref.$ref = entry.mappedPathFromRoot;
}
pathFromRoot = entry.pathFromRoot;
pathFromRoot = entry.mappedPathFromRoot;
hash = customRoots[entry.file][entry.hash];
entry.$ref.$ref = entry.pathFromRoot;
}

@@ -306,7 +308,13 @@ else if (!entry.external) {

hash = entry.hash;
pathFromRoot = entry.pathFromRoot;
// This is the first $ref to point to this value, so dereference the value.
// Any other $refs that point to the same value will point to this $ref instead
entry.$ref = entry.parent[entry.key] = $Ref.dereference(entry.$ref, entry.value);
// Any other $refs that point to the sam e value will point to this $ref instead
if (entry.file in customRoots && customRoots[entry.file]["#"]) {
entry.$ref.$ref = entry.mappedPathFromRoot;
pathFromRoot = entry.mappedPathFromRoot;
}
else {
entry.$ref = entry.parent[entry.key] = $Ref.dereference(entry.$ref, entry.value);
pathFromRoot = entry.pathFromRoot;
}

@@ -313,0 +321,0 @@ if (entry.circular) {

{
"name": "@stoplight/json-schema-ref-parser",
"version": "9.1.3-beta.1",
"version": "9.1.3-beta.2",
"description": "Parse, Resolve, and Dereference JSON Schema $ref pointers",

@@ -5,0 +5,0 @@ "keywords": [