-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
[BUG] Https protocol schema is not handled correctly in java 11 native code #3729
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
Comments
@thecrazzymouse would you like to file a PR for this? |
I have created the PR |
Hi @thecrazzymouse, thanks for bringing this up and creating the PR. I believe that the scheme is taken from the spec, for example the server url in OpenAPI v3.0 or the schemes in OpenAPI v2.0. The scheme is calculated by parsing that URL as seen in the code below. So, if you have access to the spec, the simplest thing is to change it there. Lines 157 to 158 in 14a3934
I can imagine one scenario where changing the scheme would be useful, and that is when the the spec lists multiple URL's/schemes. There is a known limitation of openapi-generator, where it only looks at the first of multiple urls/schemes, and ignores the rest. To get around this limitation, you would need to manually override the scheme as you suggest. Is this the situation that you are in? Are you connecting to a server with multiple urls/schemes? |
the spec could also contain a default url, like |
That's definitely reasonable. The PR looks good to me, with the one comment I left that I think it would follow the existing pattern better if there were only a setter and no getter. |
…e code OpenAPITools#3729 * added getter for schema
* master: (45 commits) update python samples Two tiny fixes for Java Vertx client (#3683) Exclude "test" from packages so that it is not installed as top-level package when "pip installing" the generated sdk (#3731) [java-client] add unit test for JDK 11 HttpClient (#3735) [R] feat(r): handling error response for 3xx cases (#3571) [Dart] Avoid redundant null checking in fromJson (#3632) [core] Set isMultipart=true for multipart operations, fix possible NPE (#3750) reenable kotlin client tests in shippable ci (#3751) Fix null assignation to header/query param map (#3749) Mockito 3.0.0 (#3732) Update to swagger-parser to 2.0.14-OpenAPITools.org-1 (#3737) Add a link to a Qiita blog post (#3747) update csharp samples Simple spelling error in dotnet core comments (#3746) better support for multipart (#3736) [typescript-fetch] fix #1998: prefix req ifaces. (#3740) cpp-qt5-client: add valgrind memory test (#3663) [typescript-angular] Encode objects for multipart/form-data with json - fixes #2733 (#3738) [BUG] Https protocol schema is not handled correctly in java 11 native code #3729 (#3730) comment out kotlin client tests ...
Description
The schema in the ApiClient is hard wired to http and there is no way to change this like the other parameters like host.
openapi-generator version
4.1.0
Suggest a fix
Add a setter method for schema:
public ApiClient setScheme(String scheme){ this.scheme = scheme; return this; }
The text was updated successfully, but these errors were encountered: