-
Notifications
You must be signed in to change notification settings - Fork 537
Fix for #742 #754
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
Fix for #742 #754
Conversation
Server with relative location are not converted to an absolute url
|
Fix for #742 |
jmini
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you a lot for this PR. This is a great start.
Line 351 in modules/swagger-parser-v3/src/main/java/io/swagger/v3/parser/util/OpenAPIDeserializer.java
Current (your PR did not change it):
Server server = getServer((ObjectNode) item, location, result);Should be:
Server server = getServer((ObjectNode) item, location, result, path);To use the new method you have introduced.
Other point (I do not know if it matters for this project. You are working with tabs and the code is formatted with spaces.
| String value = getString("url", obj, true, location, result); | ||
| if(StringUtils.isNotBlank(value)) { | ||
| File file = new File(value); | ||
| if(!isValidURL(value) && !file.isAbsolute() && path != null){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The check && !file.isAbsolute() is not necessary if you consider a server definition like this:
{
"description": "Server relative to root path",
"url": "/api/v2"
}If you remove the check, then you also can remove File file = new File(value);
|
@A-Aravindhan thank you a lot for this PR to fix my issue #742 During the review, I discovered some points that I have addressed with: jmini@21c0b5e (on top of your commit A-Aravindhan@935c015). I did not modify indentation (spaces vs tabs). I also think that it is important to add a unit test with this PR. I have extended my example specification in #742. I then added a new test case to See my commit: jmini@209994a Without your fix the test is red, with your fix it is green. Can you please integrate these commits (or similar ones) in this Pull Request? |
|
Hi, @A-Aravindhan @jmini to be able to merge this PR, can you please integrate your changes into one PR? Thanks! |
|
I am not maintainer of this project, I can not update it: I do not have write permissions on Performing a quick API call on this PR, I see that you have the permission: You need to add both forks as remote (assuming you work with ssh on GitHub). This should do it: Let me know if it does not work. |
|
@gracekarina : I have opened a replacement PR that contains all the changes discussed here => #773 |
|
Hi, I just merged the #773 PR. Thanks for your contributions. |
No description provided.