Skip to content

Commit

Permalink
Do not roll up references in the root document
Browse files Browse the repository at this point in the history
Fixes #112
  • Loading branch information
whitlockjc committed Apr 25, 2017
1 parent e863a9c commit 74f24a1
Show file tree
Hide file tree
Showing 6 changed files with 329 additions and 292 deletions.
4 changes: 2 additions & 2 deletions browser/json-refs-min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion browser/json-refs-standalone-min.js

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions browser/json-refs-standalone.js

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions browser/json-refs.js

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1274,11 +1274,14 @@ function resolveRefs (obj, options) {
});

function walkRefs (root, refPtr, refPath) {
var refPtrParts = refPtr.split('#');
var refDetails = results.refs[refPtr];
var refDeps;

// Record the reference (relative to the root document)
allRefs[pathToPtr(options.subDocPath.concat(refPath))] = refDetails;
// Record the reference (relative to the root document unless the reference is in the root document)
allRefs[refPtrParts[0] === options.location ?
'#' + refPtrParts[1] :
pathToPtr(options.subDocPath.concat(refPath))] = refDetails;

// Do not walk invalid references
if (refDetails.circular || !isValid(refDetails)) {
Expand Down
Loading

0 comments on commit 74f24a1

Please # to comment.