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:
In spec root directory, $ref: ./components/schemas/Thing.yaml
In components/paths subdirectory, $ref: ../../components/schemas/Thing.yaml
The parser will produce a Thing and a Thing_1 schema object instead of reusing Thing 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.
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.