Skip to content

Commit 1dccb6b

Browse files
committed
fix: recursively resolve and dereference in extended refs
1 parent d9580c0 commit 1dccb6b

File tree

2 files changed

+5
-20
lines changed

2 files changed

+5
-20
lines changed

lib/bundle/index.js

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,7 @@ function crawl (parent, key, path, pathFromRoot, indirections, inventory, $refs,
7878
for (let key of keys) {
7979
let keyPath = Pointer.join(path, key);
8080
let keyPathFromRoot = Pointer.join(pathFromRoot, key);
81-
let value = obj[key];
82-
83-
if ($Ref.isAllowed$Ref(value)) {
84-
inventory$Ref(obj, key, path, keyPathFromRoot, indirections, inventory, $refs, options, customRoots);
85-
}
86-
else {
87-
crawl(obj, key, keyPath, keyPathFromRoot, indirections, inventory, $refs, options, customRoots);
88-
}
81+
crawl(obj, key, keyPath, keyPathFromRoot, indirections, inventory, $refs, options, customRoots);
8982
}
9083
}
9184
}

lib/resolve-external.js

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -58,18 +58,10 @@ function crawl (obj, path, $refs, options) {
5858
if ($Ref.isExternal$Ref(obj)) {
5959
promises.push(resolve$Ref(obj, path, $refs, options));
6060
}
61-
else {
62-
for (let key of Object.keys(obj)) {
63-
let keyPath = Pointer.join(path, key);
64-
let value = obj[key];
65-
66-
if ($Ref.isExternal$Ref(value)) {
67-
promises.push(resolve$Ref(value, keyPath, $refs, options));
68-
}
69-
else {
70-
promises = promises.concat(crawl(value, keyPath, $refs, options));
71-
}
72-
}
61+
for (let key of Object.keys(obj)) {
62+
let keyPath = Pointer.join(path, key);
63+
let value = obj[key];
64+
promises = promises.concat(crawl(value, keyPath, $refs, options));
7365
}
7466
}
7567

0 commit comments

Comments
 (0)