Fix #867 by intercepting spec loading#1709
Open
mromaszewicz wants to merge 3 commits into
Open
Conversation
This change adds a shim into the Kin loader which attempts to find an `openapi` or `swagger` version key in the spec, and returns an error if it's an unsupported version. in the case where the version can't be detected, we do nothing and behave as previously, failing in the parsing step.
Member
|
If we're doing some renaming here could we do it all (under #672) first as a separate PR? |
Member
Author
I didn't want to touch the old function in case someone is using it, so I marked it deprecated and made a new one. This isn't part of some renaming effort. My IDE linter yells at me for calling deprecated functions, hence the update to calling the new one. |
Key off the error for unsupported version instead of doing another version check. The loader shim should not return errors, because it'll change the behavior of the loader. Only return existing errors, don't introduce new ones.
Member
Author
|
Ok, I undid the function renaming and after some testing, fixed some issues which would have been regressions. It works as expected now on all kinds of specs. |
jamietanna
self-requested a review
August 21, 2024 21:03
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change adds a shim into the Kin loader which attempts to find an
openapiorswaggerversion key in the spec, and returns an error if it's an unsupported version. in the case where the version can't be detected, we do nothing and behave as previously, failing in the parsing step.Closes #867