@apidevtools/json-schema-ref-parser
Advanced tools
Comparing version 9.0.5 to 9.0.6
@@ -60,3 +60,6 @@ "use strict"; | ||
circular = dereferenced.circular; | ||
obj[key] = dereferenced.value; | ||
// Avoid pointless mutations; breaks frozen objects to no profit | ||
if (obj[key] !== dereferenced.value) { | ||
obj[key] = dereferenced.value; | ||
} | ||
} | ||
@@ -67,3 +70,6 @@ else { | ||
circular = dereferenced.circular; | ||
obj[key] = dereferenced.value; | ||
// Avoid pointless mutations; breaks frozen objects to no profit | ||
if (obj[key] !== dereferenced.value) { | ||
obj[key] = dereferenced.value; | ||
} | ||
} | ||
@@ -70,0 +76,0 @@ else { |
@@ -67,2 +67,3 @@ "use strict"; | ||
* @param {$RefParserOptions} options | ||
* @param {string} pathFromRoot - the path of place that initiated resolving | ||
* | ||
@@ -75,3 +76,3 @@ * @returns {Pointer} | ||
*/ | ||
Pointer.prototype.resolve = function (obj, options) { | ||
Pointer.prototype.resolve = function (obj, options, pathFromRoot) { | ||
let tokens = Pointer.parse(this.path, this.originalPath); | ||
@@ -88,2 +89,6 @@ | ||
if (typeof this.value === "object" && this.value !== null && "$ref" in this.value) { | ||
return this; | ||
} | ||
let token = tokens[i]; | ||
@@ -100,3 +105,6 @@ if (this.value[token] === undefined || this.value[token] === null) { | ||
// Resolve the final value | ||
resolveIf$Ref(this, options); | ||
if (!this.value || this.value.$ref && url.resolve(this.path, this.value.$ref) !== pathFromRoot) { | ||
resolveIf$Ref(this, options); | ||
} | ||
return this; | ||
@@ -233,3 +241,3 @@ }; | ||
else { | ||
let resolved = pointer.$ref.$refs._resolve($refPath, url.getHash(pointer.path), options); | ||
let resolved = pointer.$ref.$refs._resolve($refPath, pointer.path, options); | ||
pointer.indirections += resolved.indirections + 1; | ||
@@ -236,0 +244,0 @@ |
@@ -115,3 +115,3 @@ "use strict"; | ||
try { | ||
return pointer.resolve(this.value, options); | ||
return pointer.resolve(this.value, options, pathFromRoot); | ||
} | ||
@@ -118,0 +118,0 @@ catch (err) { |
{ | ||
"name": "@apidevtools/json-schema-ref-parser", | ||
"version": "9.0.5", | ||
"version": "9.0.6", | ||
"description": "Parse, Resolve, and Dereference JSON Schema $ref pointers", | ||
@@ -55,3 +55,3 @@ "keywords": [ | ||
"@babel/polyfill": "^7.10.4", | ||
"@jsdevtools/eslint-config": "^1.0.5", | ||
"@jsdevtools/eslint-config": "^1.0.7", | ||
"@jsdevtools/host-environment": "^2.0.4", | ||
@@ -61,3 +61,3 @@ "@jsdevtools/karma-config": "^3.1.7", | ||
"@types/json-schema": "^7.0.4", | ||
"@types/node": "^14.0.23", | ||
"@types/node": "^14.0.25", | ||
"chai": "^4.2.0", | ||
@@ -64,0 +64,0 @@ "chai-subset": "^1.6.0", |
@@ -132,3 +132,3 @@ JSON Schema $Ref Parser | ||
-------------------------- | ||
I welcome any contributions, enhancements, and bug-fixes. [File an issue](https://github.com/APIDevTools/json-schema-ref-parser/issues) on GitHub and [submit a pull request](https://github.com/APIDevTools/json-schema-ref-parser/pulls). | ||
I welcome any contributions, enhancements, and bug-fixes. [Open an issue](https://github.com/APIDevTools/json-schema-ref-parser/issues) on GitHub and [submit a pull request](https://github.com/APIDevTools/json-schema-ref-parser/pulls). | ||
@@ -135,0 +135,0 @@ #### Building/Testing |
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
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
147131
3070