-
-
Notifications
You must be signed in to change notification settings - Fork 7k
feat (JAVA NATIVE): add support for useSingleRequestParameter to java native client #21331
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
feat (JAVA NATIVE): add support for useSingleRequestParameter to java native client #21331
Conversation
d8839e7
to
0796186
Compare
@@ -152,7 +152,7 @@ public class {{classname}} { | |||
{{#isDeprecated}} | |||
@Deprecated | |||
{{/isDeprecated}} | |||
public {{#asyncNative}}CompletableFuture<{{/asyncNative}}ApiResponse<{{{returnType}}}{{^returnType}}Void{{/returnType}}>{{#asyncNative}}>{{/asyncNative}} {{operationId}}WithHttpInfo(API{{operationId}}Request apiRequest) throws ApiException { | |||
public {{#asyncNative}}CompletableFuture<{{/asyncNative}}ApiResponse<{{{returnType}}}{{^returnType}}Void{{/returnType}}>{{#asyncNative}}>{{/asyncNative}} {{operationId}}WithHttpInfo(API{{#lambda.titlecase}}{{operationId}}{{/lambda.titlecase}}Request apiRequest) throws ApiException { |
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.
thanks for the PR
why do you need to wrap operationId with titlecase lambda?
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.
@wing328 Without it the operationId as part of the parameter class name would be starting with lowercase. For example it would be “APIdeletePetRequest” without it and “APIDeletePetRequest”. The second one is more camel case and Java typical in my opinion. :)
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.
so this PR is more like "correcting" the parameter class naming, right?
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.
@wing328 I "corrected" the parameter class name, yes but I also enabled the generation for the java native client (see the changes in JavaClientCodegen). Before this PR this part was never generated.
@@ -800,7 +800,7 @@ public void processOpts() { | |||
public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List<ModelMap> allModels) { | |||
super.postProcessOperationsWithModels(objs, allModels); | |||
|
|||
if (this.getSingleRequestParameter() && (isLibrary(JERSEY2) || isLibrary(JERSEY3) || isLibrary(OKHTTP_GSON))) { | |||
if (this.getSingleRequestParameter() && (isLibrary(JERSEY2) || isLibrary(JERSEY3) || isLibrary(OKHTTP_GSON) || isLibrary(NATIVE))) { |
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.
@wing328 This PR enables the generation of the single parameter class for the Java native client. Before this PR, enabling ‘useSingleRequestParameter’ doesn’t changed anything for the Java native client.
* @return CompletableFuture<Void> | ||
* @throws ApiException if fails to make API call | ||
*/ | ||
public CompletableFuture<Void> testGroupParameters(APItestGroupParametersRequest apiRequest) throws ApiException { | ||
public CompletableFuture<Void> testGroupParameters(APITestGroupParametersRequest apiRequest) throws ApiException { |
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.
@Nicklas2751 fyi. i saw this change, which may become a breaking change for other users
for the time, we will consider this as a bug fix to correct the naming and see if there's a need to provide a fallback later (one way to fallback is to use customized templates)
This PR adds support for the
useSingleRequestParameter
to the Java native client.PR checklist
Commit all changed files.
This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
These must match the expectations made by your contribution.
You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example
./bin/generate-samples.sh bin/configs/java*
.IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
master
(upcoming7.x.0
minor release - breaking changes with fallbacks),8.0.x
(breaking changes without fallbacks)@bbdouglas (2017/07) @sreeshas (2017/08) @jfiala (2017/08) @lukoyanov (2017/09) @cbornet (2017/09) @jeff9finger (2018/01) @karismann (2019/03) @Zomzog (2019/04) @lwlee2608 (2019/10) @martin-mfg (2023/08)