-
Notifications
You must be signed in to change notification settings - Fork 526
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
Parser does not resolve $ref pointing to relative locations on classpath #1133
Comments
Did you manage to find out the workaround for this? |
@abangfadli Yes, the attached swagger-parser-unified-diff.txt file lists code changes I made to 2.0.13-SNAPSHOT to get it working. I've also added a change (PathUtilTest.java) to a test that the changes fail. Without the code changes above, a workaround is to keep schema files at the root of the classpath (not in a jar file) - $ref files can correctly resolve sub-paths from there. |
Pull request #1134 raised to fix this issue. Could one of the regular maintainers review that at your convenience? |
Hi @scottr-ad yes I'll have a look, and I need to test it also. thanks a lot for this PR! |
Hi @gracekarina Thanks for taking a look at this PR. I was hoping to get this fix into the next release, if possible. Have you had a chance to test it, or recommend any changes? |
closed by #1134 |
Is this the same issue as I've posted in the Atlassian Validation repo? https://bitbucket.org/atlassian/swagger-request-validator/issues/231/relative-refs-not-being-loaded-when |
@ChubbyArse - it could be. Try adding swagger-parser v 2.0.14-SNAPSHOT directly to your maven or gradle build file to override the version swagger-request-validator is pulling in, and see if that fixes your problem. |
@scottr-ad - Is that publically available? I've got this and it's failing to find anything:
|
You could try building it locally using mvn clean install and see if that works. @gracekarina Do you know when you plan to release 2.0.14? |
@scottr-ad Do you know the repo that is serving the 2.0.14-SNAPSHOT version? I may need to add it to get it? |
Found it but we aren't allowed access to SNAPSHOTs so were dependent on the release of 2.0.14 |
Hi, @scottr-ad @ChubbyArse we are planning a release this week. |
@gracekarina - Thanks will look forward to it. Quick question will the SNAPSHOT dependencies be set to release versions, as we aren't able to pull in snapshots - currently in master there is:
|
Hi @ChubbyArse, yes, in release version all dependencies will be set to release version |
Thanks to all involved in this one - our issue has been resolved with 2.0.14. |
When parsing a schema file loaded from the classpath (either on file or in jar), the parser does not correctly resolve $ref elements pointing to other json or yaml files in relative path locations.
For example,
schema.yaml
data-structures.yaml
The parser should be able to resolve this relative $ref path when loading from the classpath, however it gives the following error message:
In debugging I observed two problems occurring:
Attached is a test case demonstrating these issues ( as a zipped up maven build), a unified diff to fix the issues, and a test case fix
swagger-parser-bug-test.zip
swagger-parser-unified-diff.txt
PathUtilTest.java.txt
The text was updated successfully, but these errors were encountered: