File tree Expand file tree Collapse file tree
modules/openapi-generator/src/main/resources/Java/libraries/vertx Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ public interface {{classname}} {
2828 { {/isDeprecated} }
2929 default Future<{ {{returnType} }}{ {^returnType} }Void{ {/returnType} }> { {operationId} }({ {#allParams} }{ {> nullable_var_annotations} } { {{dataType} }} { {paramName} }{ {^-last} }, { {/-last} }{ {/allParams} }){
3030 Promise< {{{returnType} }}{ {^returnType} }Void{ {/returnType} }> promise = Promise.promise();
31- { {operationId} }({ {#allParams} }{ {paramName} }, { {/allParams} }promise);
31+ { {operationId} }({ {#allParams} }{ {paramName} }, { {/allParams} }wrapPromise( promise) );
3232 return promise.future();
3333 }
3434
@@ -44,11 +44,22 @@ public interface {{classname}} {
4444 { {/isDeprecated} }
4545 default Future<{ {{returnType} }}{ {^returnType} }Void{ {/returnType} }> { {operationId} }({ {#allParams} }{ {> nullable_var_annotations} } { {{dataType} }} { {paramName} }, { {/allParams} }ApiClient.AuthInfo authInfo){
4646 Promise< {{{returnType} }}{ {^returnType} }Void{ {/returnType} }> promise = Promise.promise();
47- { {operationId} }({ {#allParams} }{ {paramName} }, { {/allParams} }authInfo, promise);
47+ { {operationId} }({ {#allParams} }{ {paramName} }, { {/allParams} }authInfo, wrapPromise( promise) );
4848 return promise.future();
4949 }
5050
5151 { {/supportVertxFuture} }
5252 { {/operation} }
5353 { {/operations} }
54+ { {#supportVertxFuture} }
55+ static <T > Handler<AsyncResult <T >> wrapPromise(Promise<T > promise){
56+ return result -> {
57+ if (result.succeeded()) {
58+ promise.complete(result.result());
59+ } else {
60+ promise.fail(result.cause());
61+ }
62+ };
63+ }
64+ { {/supportVertxFuture} }
5465}
You can’t perform that action at this time.
0 commit comments