Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When the parser is unable to resolve a path, give the user supplied path in the error. #75

Merged
merged 1 commit into from
Mar 17, 2018
Merged

Conversation

realityking
Copy link
Contributor

This is an attempt to fix APIDevTools/swagger-parser#76.

I'm a little out of my depth here but as far as I can tell this change should work in all-cases.

@coveralls
Copy link

coveralls commented Mar 4, 2018

Coverage Status

Coverage increased (+0.006%) to 95.244% when pulling f63c066 on realityking:ref-error-relative into 44669b8 on BigstickCarpet:master.

Copy link
Member

@JamesMessinger JamesMessinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! I just have one question/change request.

* @returns {Pointer}
*/
$Ref.prototype.resolve = function (path, options) {
var pointer = new Pointer(this, path);
$Ref.prototype.resolve = function (path, options, originalPath) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see anywhere where this method is called with the new parameter. Am I missing something? Or is the parameter always undefined? If the latter, then we can remove the parameter from here and from the Pointer constructor.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks. Not sure how I missed that

@JamesMessinger JamesMessinger merged commit 0f16faa into APIDevTools:master Mar 17, 2018
@realityking realityking deleted the ref-error-relative branch March 17, 2018 10:24
@JamesMessinger
Copy link
Member

json-schema-ref-parser v5.0.0 has been published to npm and includes this fix. Thanks again for your help!

@alasdairhurst
Copy link

alasdairhurst commented Mar 18, 2018

Does this also fix the issue with the custom resolver not getting the original $ref? (i'll test when i get a chance)
APIDevTools/swagger-parser#76 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Absolute path in $ref resolving errors are not helpful
4 participants