Skip to content
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

Reading from remote location fails if relative refs are involved #650

Closed
marcelstoer opened this issue Feb 20, 2018 · 3 comments
Closed
Assignees

Comments

@marcelstoer
Copy link

Reading a Swagger definition from a remote location fails if it contains relative refs (at the same location). This seems very much related to what @fehguy addressed in #338. I'm on v1.0.34.

I've got a Swagger file at https://somehost/src/main/resources/services/broker-monitor/v1/broker-monitor-service.yaml.

It contains the following snippet

...
definitions:
  SomeObject:
    type: object
    ...
      message:
        $ref: '../../../technical-definitions/error-handling/v2/error-model.yaml#/definitions/GeneralError'

That referenced definition resides at https://somehost/src/main/resources/technical-definitions/error-handling/v2/error-model.yaml.

If both files are on the local file system then all is well, but reading from the remote location fails with

Caused by: java.lang.ArrayIndexOutOfBoundsException
	at java.lang.System.arraycopy(Native Method)
	at io.swagger.parser.util.RefUtils.buildUrl(RefUtils.java:113)
	at io.swagger.parser.util.RefUtils.readExternalUrlRef(RefUtils.java:68)

The comment at

is correct: it is a relative reference. The problem is that it's treated like a local relative reference.

@gracekarina
Copy link
Contributor

gracekarina commented Mar 10, 2018

Hi @marcelstoer, the urls are broken, can you please add the files. thanks!

@gracekarina gracekarina self-assigned this Jun 7, 2018
@beikov
Copy link

beikov commented Apr 28, 2024

Seems like a duplicate of #750

@frantuma
Copy link
Member

frantuma commented May 1, 2024

fixed by #2082

@frantuma frantuma closed this as completed May 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants