Skip to content

Commit

Permalink
release v10.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesMessinger committed Sep 7, 2020
1 parent 3052257 commit c47b3f5
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 17 deletions.
26 changes: 20 additions & 6 deletions online/js/bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -978,13 +978,19 @@ function crawl (obj, path, pathFromRoot, parents, $refs, options) {
if ($Ref.isAllowed$Ref(value, options)) {
dereferenced = dereference$Ref(value, keyPath, keyPathFromRoot, parents, $refs, options);
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;
}
}
else {
if (parents.indexOf(value) === -1) {
dereferenced = crawl(value, keyPath, keyPathFromRoot, parents, $refs, options);
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;
}
}
else {
circular = foundCircularReference(keyPath, $refs, options);
Expand Down Expand Up @@ -2041,14 +2047,15 @@ function Pointer ($ref, path, friendlyPath) {
*
* @param {*} obj - The object that will be crawled
* @param {$RefParserOptions} options
* @param {string} pathFromRoot - the path of place that initiated resolving
*
* @returns {Pointer}
* Returns a JSON pointer whose {@link Pointer#value} is the resolved value.
* If resolving this value required resolving other JSON references, then
* the {@link Pointer#$ref} and {@link Pointer#path} will reflect the resolution path
* of the resolved value.
*/
Pointer.prototype.resolve = function (obj, options) {
Pointer.prototype.resolve = function (obj, options, pathFromRoot) {
let tokens = Pointer.parse(this.path, this.originalPath);

// Crawl the object, one token at a time
Expand All @@ -2060,6 +2067,10 @@ Pointer.prototype.resolve = function (obj, options) {
this.path = Pointer.join(this.path, tokens.slice(i));
}

if (typeof this.value === "object" && this.value !== null && "$ref" in this.value) {
return this;
}

let token = tokens[i];
if (this.value[token] === undefined || this.value[token] === null) {
this.value = null;
Expand All @@ -2071,7 +2082,10 @@ Pointer.prototype.resolve = function (obj, options) {
}

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

Expand Down Expand Up @@ -2203,7 +2217,7 @@ function resolveIf$Ref (pointer, options) {
pointer.circular = true;
}
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;

if ($Ref.isExtended$Ref(pointer.value)) {
Expand Down Expand Up @@ -2374,7 +2388,7 @@ $Ref.prototype.get = function (path, options) {
$Ref.prototype.resolve = function (path, options, friendlyPath, pathFromRoot) {
let pointer = new Pointer(this, path, friendlyPath);
try {
return pointer.resolve(this.value, options);
return pointer.resolve(this.value, options, pathFromRoot);
}
catch (err) {
if (!options || !options.continueOnError || !isHandledError(err)) {
Expand Down
8 changes: 4 additions & 4 deletions online/js/bundle.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion online/js/bundle.min.js

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions online/js/bundle.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@apidevtools/swagger-parser",
"version": "10.0.1",
"version": "10.0.2",
"description": "Swagger 2.0 and OpenAPI 3.0 parser and validator for Node and browsers",
"keywords": [
"swagger",
Expand Down

0 comments on commit c47b3f5

Please sign in to comment.