-
Notifications
You must be signed in to change notification settings - Fork 533
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
Unexpected warning when URL of server object is relative URL #1509
Comments
From OpenAPI specs and Swagger doc:
Found the related PR is #1301 and it's introduced since v2.0.18. There's also a change in #1412 for RelativeReferenceTest. It replaced the relative URL with absolute URL. |
The changes has been rolled back. |
Thanks for your reply! The issue doesn't seem to be resolved. I tried with latest release v2.0.24 but still saw the warning. A similar issue is also mentioned on #1329 (comment) I don't see any error/exception but this warning actually. So the point (i think) is if the warning here is appropriate: https://github.com/swagger-api/swagger-parser/blob/master/modules/swagger-parser-v3/src/main/java/io/swagger/v3/parser/util/OpenAPIDeserializer.java#L429 |
As you said having relative url is valid and it should not throw an warning. |
Hi I think I'm also hitting this issue, when I grab https://petstore3.swagger.io/api/v3/openapi.json which has
and I parse it via
with swagger-parser-v3-2.0.24.jar If I rollback back to swagger-parser-v3-2.0.17.jar, we're all good. Thanks |
@gracekarina Thanks for your reply! Have you tried with local OpenAPI schema file instead of the one is served on the server? In my use case I have to package the schema file in jar. |
I guess the folks here OpenAPITools/openapi-generator#8266 also used local schema file to do codegen |
Hi @VcamX , Which version of parser is being used? |
I tried both 2.0.24 and 2.0.18 but they didn't work, but 2.0.17 has no issue as @boagm mentioned.
I suspect the issue exists since 2.0.18. |
@VcamX, as I have tested locally (with remote and local specs), I could only reproduced the issue in 2.0.18, the following versions does not have the issue. So I kindly ask you to attach here the spec you are using, or a small sample of the jar being use so I can reproduce the issue and help fixed it. Thank you. |
Hi @gracekarina, Thanks for adding the testcase #1519 , it has enabled me to figure what is the difference that leads to me still hitting the issue with swagger-parser-v3-2.0.24.jar res.getMessages() shows "String index out of range: 0" and "res.getOpenAPI() is null" when parsing the OpenAPI from https://petstore3.swagger.io/api/v3/openapi.json, which has
In your testcase you have While in my case the OpenAPI is already downloaded and on local file system so in I have The spec https://swagger.io/docs/specification/api-host-and-base-path/ says I note @VcamX said "In my use case I have to package the schema file in jar." I wonder what is passed as arg0 to So what should "relative" mean for a location on a filesystem? Interestingly I then tried using: In this case of using this file url the parsed POJ model gives back the unmodified relative path:- For my use case I could switch to using a file URL rather than a path, but I do think it's rather inconsistent behavour here, so would appropriate you thoughts? Thanks |
Hi, @VcamX, @boagm, I added here two tests to try to reproduce the issues here exposed, but I was not able to reproduce them.
Thanks for your comments. Please check the commits and if you have an spec, or a sample with the issue reproduced please attach it to a new issue and mention this one. |
Thanks @gracekarina, As per my comment on your "testServerRelativeUrlLocal", we're getting close, but I'd not realized another subtlety .. to reproduce the "String index out of range: 0" we need to be passing an absolute path, just "openapilocal.json" did not reproduce the issue - while "C:\devel\test\openapilocal.json" does. Thanks |
@gracekarina for my case, I was using relative path like |
In
SwaggerParseResult
, I saw message "attribute .servers. invalid url: /v1 ".Wonder if relative URL is not supported anymore.
Thanks!
The text was updated successfully, but these errors were encountered: