-
Notifications
You must be signed in to change notification settings - Fork 534
Normalize relative ref paths to avoid duplicating schemas #2105
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
Open
ctreatma
wants to merge
4
commits into
swagger-api:master
Choose a base branch
from
ctreatma:collapse-equivalent-refs
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
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
6f1d634
to
18d5450
Compare
ctreatma
commented
Jun 17, 2024
modules/swagger-parser-v3/src/test/resources/oas3.fetched/components/parameters/Exclude.yaml
Outdated
Show resolved
Hide resolved
6 tasks
Just ran into this issue today. Glad to see a fix is on the way (hopefully soon). Thanks! |
d25dc19
to
e2fd955
Compare
e2fd955
to
8174b8f
Compare
I rebased on the latest from |
47a4931
to
26e34ae
Compare
ctreatma
commented
Jan 8, 2025
...es/swagger-parser-v3/src/main/java/io/swagger/v3/parser/processors/ExternalRefProcessor.java
Outdated
Show resolved
Hide resolved
929aacc
to
74720bc
Compare
ctreatma
added a commit
to equinix/equinix-sdk-go
that referenced
this pull request
Feb 24, 2025
The semantic-release tool explicitly ignores the `.gitignore` file, which means that the automated release process will commit all files that are present in the local repo even if they are in the `.gitignore`. This updates the Metal codegen task to explicitly clean up the temporary merged spec. If swagger-api/swagger-parser#2105 gets merged and is included in an openapi-generator release before this SDK loses support for Metal, we can remove the temporary merged Metal spec.
74720bc
to
adcfebb
Compare
adcfebb
to
1cd8e74
Compare
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.
Currently, if an OpenAPI spec contains multiple relative refs to the same file, but those refs are located in different files and use different relative paths to reach the one file, swagger-parser will create a separate, duplicate schema for each relative path rather than reusing the same schema across all equivalent paths.
For example, given a spec with the following refs:
$ref: ./components/schemas/Thing.yaml
$ref: ../../components/schemas/Thing.yaml
The parser will produce a
Thing
and aThing_1
schema object instead of reusingThing
for the second, equivalent reference.This updates the ref processor to resolve relative paths before processing relative refs in order to produce a single
Thing
schema that is reused for all equivalent references.Fixes #2016, fixes #1518, and maybe others.