@stoplight/json-schema-ref-parser
Advanced tools
Comparing version
@@ -57,2 +57,6 @@ "use strict"; | ||
if (!pathFromRoot.startsWith(defaults.defaultRoot) && !isSchemaPlacement(pathFromRoot.split("/"))) { | ||
return null; | ||
} | ||
if (hash !== "#" && hash !== null) { | ||
@@ -74,1 +78,14 @@ return defaults.generateKey(schema, file, normalizeOasSchemasHash(hash, defaults.defaultRoot), pathFromRoot); | ||
} | ||
// this should return true for every place in a OAS document that can reference a JSON Schema model | ||
function isSchemaPlacement (path) { | ||
if (isInOasOperation(path) && path.includes("schema")) { | ||
return true; | ||
} | ||
return false; | ||
} | ||
function isInOasOperation (path) { | ||
return path.length > 3 && path[1] === "paths"; | ||
} |
@@ -148,3 +148,3 @@ "use strict"; | ||
if (options.bundle.generateKey && file !== $refs._root$Ref.path) { | ||
if (options.bundle.generateKey && file !== $refs._root$Ref.path && !(path.indexOf($refs._root$Ref.path) === 0 && $ref.$ref.indexOf("#/") === 0)) { | ||
if (!customRoots[file]) { | ||
@@ -151,0 +151,0 @@ customRoots[file] = {}; |
{ | ||
"name": "@stoplight/json-schema-ref-parser", | ||
"version": "9.1.0", | ||
"version": "9.1.1", | ||
"description": "Parse, Resolve, and Dereference JSON Schema $ref pointers", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
170084
0.32%3679
0.35%