-
Notifications
You must be signed in to change notification settings - Fork 537
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
base: master
Are you sure you want to change the base?
Conversation
6f1d634 to
18d5450
Compare
modules/swagger-parser-v3/src/test/resources/oas3.fetched/components/parameters/Exclude.yaml
Outdated
Show resolved
Hide resolved
|
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
...es/swagger-parser-v3/src/main/java/io/swagger/v3/parser/processors/ExternalRefProcessor.java
Outdated
Show resolved
Hide resolved
929aacc to
74720bc
Compare
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
1cd8e74 to
ddc074b
Compare
|
@MichakrawSB I see that this PR has been assigned to me but I'm not clear what needs to be done to move it forward. Is there something I need to address before the GitHub Actions workflows can be approved to run on this PR? |
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.yamlThe parser will produce a
Thingand aThing_1schema object instead of reusingThingfor the second, equivalent reference.This updates the ref processor to resolve relative paths before processing relative refs in order to produce a single
Thingschema that is reused for all equivalent references.Fixes #2016, fixes #1518, and maybe others.