Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/dereference.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ function dereference$Ref ($ref, path, pathFromRoot, parents, $refs, options) {
debug('Dereferencing $ref pointer "%s" at %s', $ref.$ref, path);

var $refPath = url.resolve(path, $ref.$ref);
var pointer = $refs._resolve($refPath, options);
var pointer = $refs._resolve($refPath, options, $ref.$ref);

// Check for circular references
var directCircular = pointer.circular;
Expand Down
7 changes: 4 additions & 3 deletions lib/refs.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,19 +140,20 @@ $Refs.prototype._add = function (path) {
*
* @param {string} path - The path being resolved, optionally with a JSON pointer in the hash
* @param {$RefParserOptions} [options]
* @param {string} [friendlyPath]
* @returns {Pointer}
* @protected
*/
$Refs.prototype._resolve = function (path, options) {
$Refs.prototype._resolve = function (path, options, friendlyPath) {
var absPath = url.resolve(this._root$Ref.path, path);
var withoutHash = url.stripHash(absPath);
var $ref = this._$refs[withoutHash];

if (!$ref) {
throw ono('Error resolving $ref pointer "%s". \n"%s" not found.', path, withoutHash);
throw ono('Error resolving $ref pointer "%s". \n"%s" not found.', friendlyPath || path, withoutHash);
}

return $ref.resolve(absPath, options, path);
return $ref.resolve(absPath, options, friendlyPath || path);
};

/**
Expand Down