Skip to content

[Java][Native] added WithHttpInfo method for async-native#6903

Merged
wing328 merged 5 commits intoOpenAPITools:masterfrom
bgong-mdsol:feature/java-asyncNative-withHttpInfo
Jul 17, 2020
Merged

[Java][Native] added WithHttpInfo method for async-native#6903
wing328 merged 5 commits intoOpenAPITools:masterfrom
bgong-mdsol:feature/java-asyncNative-withHttpInfo

Conversation

@bgong-mdsol
Copy link
Copy Markdown
Contributor

Description of the PR

This PR added WithHttpInfo method for asyncNative, it includes the changes below:

  • updated JavaClientCodegen
  • updated the template of api
  • updated the template of api-doc & readme
  • regenerated Petstore samples for native/asyncNative

@wing328 @cbornet @jeff9finger @bbdouglas @sreeshas @jfiala @lukoyanov @karismann @Zomzog @lwlee2608 @bkabrda @jfeltesse-mdsol @jcarres-mdsol

PR checklist

  • Read the contribution guidelines.
  • If contributing template-only or documentation-only changes which will change sample output, build the project beforehand.
  • Run the shell script ./bin/generate-samples.shto update all Petstore samples related to your fix. 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/config/java*. For Windows users, please run the script in Git BASH.
  • File the PR against the correct branch: master
  • Copy the technical committee to review the pull request if your PR is targeting a particular programming language.

* {{notes}}
* @param {{operationId}}Request {@link API{{operationId}}Request}
* @return ApiResponse<{{#returnType}}{{returnType}}{{/returnType}}{{^returnType}}Void{{/returnType}}>
* @return {{#asyncNative}}CompletableFuture<{{/asyncNative}}ApiResponse<{{#returnType}}{{returnType}}{{/returnType}}{{^returnType}}Void{{/returnType}}>{{#asyncNative}}>{{/asyncNative}}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see in the changes below that < is used directly, can't we do the same here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a part of java doc, can't use < directly.

HttpRequest.Builder localVarRequestBuilder = {{operationId}}RequestBuilder({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of copy/pasting from above, can we extract this into a separate method?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The functions using to compute another CompletionStage are similar, but return types different. Create a seperate method getApiExection(...) to handle operation error.

Copy link
Copy Markdown
Member

@wing328 wing328 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but I didn't test it locally.

@wing328 wing328 merged commit 8cd5203 into OpenAPITools:master Jul 17, 2020
@bgong-mdsol bgong-mdsol deleted the feature/java-asyncNative-withHttpInfo branch November 25, 2020 00:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants