Skip to content

Throw dereferencing errors #22

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

Merged

Conversation

taras
Copy link

@taras taras commented May 28, 2021

Motivation

I'm working on converting schemas from backstage.io into OpenAPI for backstage/backstage#2566. The schema in master seems to use incorrect references so I was surprised to find that json-schema-to-openapi-schema did not fail. It was quite confusing because the $ref didn't get resolved but the function did not fail.

Once I started looking at the code, I realized that resolver.resolve succeeds even if dereferencing fails. I believe @stoplight/json-ref-resolver should actually throw an error in this case but that would be a substantial breaking change to that library. Instead, I'm just fixing error reporting in this library.

Approach

Throw an error when dereferencing has errors in results. I added a test for this.

@taras taras force-pushed the taras/fix-error-reporting branch from dca0c7c to e9e9e77 Compare May 28, 2021 00:34
BREAKING CHANGE: derefencing errors are thrown
@taras taras force-pushed the taras/fix-error-reporting branch from 0f0c79e to 88bfe27 Compare May 28, 2021 10:38
@philsturgeon philsturgeon merged commit f6cf737 into openapi-contrib:master Jun 3, 2021
@philsturgeon
Copy link
Member

Thanks for this, good change!

@github-actions
Copy link

github-actions bot commented Jun 3, 2021

🎉 This PR is included in version 2.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

2 participants