-
Notifications
You must be signed in to change notification settings - Fork 537
Description
-
swagger-parser version: OpenAPITools/swagger-parser commit
090c789d(Thu Sep 6 07:01:26 2018 +0200) from2.0-OpenAPIToolsbranch. -
Code snippet used to load OpenAPI definition:
OpenAPI oai = new OpenAPIV3Parser().read("/path/to/index.yaml");
The attached tarball is a minimal sample which exhibits the issue:
In some circumstances, after an external reference is resolved for the first time, subsequent internal references are incorrect as they are relative to the referring document and not the root.
Output from above program attached
parser-output.txt.
This is due to ExternalRefProcessor#processRefToExternalResponse concatenating the current file and the internal reference to yield ./components/response1.yaml#components/schemas/schema whereas the reference should be on the root (unsure whether this should be /index.yaml#components/schemas/schema or /#components/schemas/schema or something else).
Note that the attached test case is not exhaustive and I suspect that all of the processRefToExternal* methods suffer from this logic error.