-
Notifications
You must be signed in to change notification settings - Fork 6k
-
Notifications
You must be signed in to change notification settings - Fork 6k
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
Unable to load RELATIVE ref #1551
Comments
Here is the error: Seems like you're using relative path for the definition of Can you replace ./parameters.json with full URL instead as the parser is expecting the full URL (https://github.com/swagger-api/swagger-parser/blob/master/modules/swagger-parser/src/main/java/io/swagger/parser/util/RefUtils.java#L71) ? |
You can find an example for reference at #1544 (comment) |
That's the issue. Sadly, we need to use relative references - this gets deployed on a number of servers with different URLs. |
To be clear, we expect this relative style to work, in line with @fehguy's assertion. |
@nickcmaynard I read #214 twice but didn't see how it's related to this issue (relative URL) that you reported. Are you referring to another issue instead? |
Definitely a typo. Will try to track down the real issue number. However, this issue should be sufficient. Essentially, @fehguy states "swagger-parser supports relative, so swagger-codegen should too". Clearly, not the case. Hence, raising the issue. |
#742 is the issue I'm referring to. |
I've read #742 and the issue #1193 associated with it. My understanding is that the thread/issue refers to relative "file" path (not URI). Looking at the swagger spec, |
swagger-codegen is being passed a URI. The URI contains a relative $ref. It throws the error linked in the original report. We expect it to work. |
Until this is fixed, I have worked around it by using swagger-parser (the JavaScript library). Here is a quick node.js script I wrote to help: https://gist.github.com/nicksloan/b4aeb117734c5c1cec81 I simply run that with This is tested and working for local file schemas, but not for hosted schema URIs. It's probably worth a try though. |
I'm not sure but I believe that this will be fixed when swagger-codegen depends on the next release of swagger-parser. More information is here: swagger-api/swagger-parser#213. |
@nickcmaynard @nicksloan do you mind pull the latest master of Swagger Codegen to see if you're still facing the issue? Thanks. |
I'll try to take a look this weekend. |
@nicksloan may I know if you've a chance to take another look? |
This should be fixed by 92af2cf |
With swagger-codegen 2.1.4, we receive this error when attempting to generate JAX-RS server from a swagger.json:
I've seen other issues (#214) where @fehguy states this should be fixed, but we're not seeing this... does anyone have any ideas, please?
The text was updated successfully, but these errors were encountered: