Skip to content

Commit 7219956

Browse files
authored
[Java] [vertx] Make supportVertxFuture compatible with vertx 5 (#23660)
* add sample for vertx5-supportVertxFuture * generate sample * call promise::handle * update samples
1 parent 1e8ef54 commit 7219956

231 files changed

Lines changed: 28328 additions & 94 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/samples-java-client-jdk11.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ jobs:
7474
- samples/client/petstore/java/webclient-useSingleRequestParameter
7575
- samples/client/petstore/java/vertx
7676
- samples/client/petstore/java/vertx5
77+
- samples/client/petstore/java/vertx5-supportVertxFuture
7778
- samples/client/petstore/java/vertx-no-nullable
7879
- samples/client/petstore/java/vertx-supportVertxFuture
7980
- samples/client/petstore/java/jersey2-java8-localdatetime
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
generatorName: java
2+
outputDir: samples/client/petstore/java/vertx5-supportVertxFuture
3+
library: vertx
4+
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml
5+
templateDir: modules/openapi-generator/src/main/resources/Java
6+
useVertx5: "true"
7+
useRxJava3: "true"
8+
additionalProperties:
9+
artifactId: petstore-vertx5-supportVertxFuture
10+
hideGenerationTimestamp: "true"
11+
dateLibrary: java8
12+
supportVertxFuture: "true"

modules/openapi-generator/src/main/resources/Java/libraries/vertx/api.mustache

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff 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}}promise::handle);
3232
return promise.future();
3333
}
3434

@@ -44,7 +44,7 @@ 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, promise::handle);
4848
return promise.future();
4949
}
5050

samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/AnotherFakeApi.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ public interface AnotherFakeApi {
1616

1717
default Future<Client> call123testSpecialTags(@javax.annotation.Nonnull Client client){
1818
Promise<Client> promise = Promise.promise();
19-
call123testSpecialTags(client, promise);
19+
call123testSpecialTags(client, promise::handle);
2020
return promise.future();
2121
}
2222

2323
void call123testSpecialTags(@javax.annotation.Nonnull Client client, ApiClient.AuthInfo authInfo, Handler<AsyncResult<Client>> handler);
2424

2525
default Future<Client> call123testSpecialTags(@javax.annotation.Nonnull Client client, ApiClient.AuthInfo authInfo){
2626
Promise<Client> promise = Promise.promise();
27-
call123testSpecialTags(client, authInfo, promise);
27+
call123testSpecialTags(client, authInfo, promise::handle);
2828
return promise.future();
2929
}
3030

samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/DefaultApi.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ public interface DefaultApi {
1616

1717
default Future<FooGetDefaultResponse> fooGet(){
1818
Promise<FooGetDefaultResponse> promise = Promise.promise();
19-
fooGet(promise);
19+
fooGet(promise::handle);
2020
return promise.future();
2121
}
2222

2323
void fooGet(ApiClient.AuthInfo authInfo, Handler<AsyncResult<FooGetDefaultResponse>> handler);
2424

2525
default Future<FooGetDefaultResponse> fooGet(ApiClient.AuthInfo authInfo){
2626
Promise<FooGetDefaultResponse> promise = Promise.promise();
27-
fooGet(authInfo, promise);
27+
fooGet(authInfo, promise::handle);
2828
return promise.future();
2929
}
3030

samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/FakeApi.java

Lines changed: 44 additions & 44 deletions
Large diffs are not rendered by default.

samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ public interface FakeClassnameTags123Api {
1616

1717
default Future<Client> testClassname(@javax.annotation.Nonnull Client client){
1818
Promise<Client> promise = Promise.promise();
19-
testClassname(client, promise);
19+
testClassname(client, promise::handle);
2020
return promise.future();
2121
}
2222

2323
void testClassname(@javax.annotation.Nonnull Client client, ApiClient.AuthInfo authInfo, Handler<AsyncResult<Client>> handler);
2424

2525
default Future<Client> testClassname(@javax.annotation.Nonnull Client client, ApiClient.AuthInfo authInfo){
2626
Promise<Client> promise = Promise.promise();
27-
testClassname(client, authInfo, promise);
27+
testClassname(client, authInfo, promise::handle);
2828
return promise.future();
2929
}
3030

samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/PetApi.java

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,47 +19,47 @@ public interface PetApi {
1919

2020
default Future<Void> addPet(@javax.annotation.Nonnull Pet pet){
2121
Promise<Void> promise = Promise.promise();
22-
addPet(pet, promise);
22+
addPet(pet, promise::handle);
2323
return promise.future();
2424
}
2525

2626
void addPet(@javax.annotation.Nonnull Pet pet, ApiClient.AuthInfo authInfo, Handler<AsyncResult<Void>> handler);
2727

2828
default Future<Void> addPet(@javax.annotation.Nonnull Pet pet, ApiClient.AuthInfo authInfo){
2929
Promise<Void> promise = Promise.promise();
30-
addPet(pet, authInfo, promise);
30+
addPet(pet, authInfo, promise::handle);
3131
return promise.future();
3232
}
3333

3434
void deletePet(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey, Handler<AsyncResult<Void>> handler);
3535

3636
default Future<Void> deletePet(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey){
3737
Promise<Void> promise = Promise.promise();
38-
deletePet(petId, apiKey, promise);
38+
deletePet(petId, apiKey, promise::handle);
3939
return promise.future();
4040
}
4141

4242
void deletePet(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey, ApiClient.AuthInfo authInfo, Handler<AsyncResult<Void>> handler);
4343

4444
default Future<Void> deletePet(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey, ApiClient.AuthInfo authInfo){
4545
Promise<Void> promise = Promise.promise();
46-
deletePet(petId, apiKey, authInfo, promise);
46+
deletePet(petId, apiKey, authInfo, promise::handle);
4747
return promise.future();
4848
}
4949

5050
void findPetsByStatus(@javax.annotation.Nonnull List<String> status, Handler<AsyncResult<List<Pet>>> handler);
5151

5252
default Future<List<Pet>> findPetsByStatus(@javax.annotation.Nonnull List<String> status){
5353
Promise<List<Pet>> promise = Promise.promise();
54-
findPetsByStatus(status, promise);
54+
findPetsByStatus(status, promise::handle);
5555
return promise.future();
5656
}
5757

5858
void findPetsByStatus(@javax.annotation.Nonnull List<String> status, ApiClient.AuthInfo authInfo, Handler<AsyncResult<List<Pet>>> handler);
5959

6060
default Future<List<Pet>> findPetsByStatus(@javax.annotation.Nonnull List<String> status, ApiClient.AuthInfo authInfo){
6161
Promise<List<Pet>> promise = Promise.promise();
62-
findPetsByStatus(status, authInfo, promise);
62+
findPetsByStatus(status, authInfo, promise::handle);
6363
return promise.future();
6464
}
6565

@@ -69,7 +69,7 @@ default Future<List<Pet>> findPetsByStatus(@javax.annotation.Nonnull List<String
6969
@Deprecated
7070
default Future<Set<Pet>> findPetsByTags(@javax.annotation.Nonnull Set<String> tags){
7171
Promise<Set<Pet>> promise = Promise.promise();
72-
findPetsByTags(tags, promise);
72+
findPetsByTags(tags, promise::handle);
7373
return promise.future();
7474
}
7575

@@ -79,87 +79,87 @@ default Future<Set<Pet>> findPetsByTags(@javax.annotation.Nonnull Set<String> ta
7979
@Deprecated
8080
default Future<Set<Pet>> findPetsByTags(@javax.annotation.Nonnull Set<String> tags, ApiClient.AuthInfo authInfo){
8181
Promise<Set<Pet>> promise = Promise.promise();
82-
findPetsByTags(tags, authInfo, promise);
82+
findPetsByTags(tags, authInfo, promise::handle);
8383
return promise.future();
8484
}
8585

8686
void getPetById(@javax.annotation.Nonnull Long petId, Handler<AsyncResult<Pet>> handler);
8787

8888
default Future<Pet> getPetById(@javax.annotation.Nonnull Long petId){
8989
Promise<Pet> promise = Promise.promise();
90-
getPetById(petId, promise);
90+
getPetById(petId, promise::handle);
9191
return promise.future();
9292
}
9393

9494
void getPetById(@javax.annotation.Nonnull Long petId, ApiClient.AuthInfo authInfo, Handler<AsyncResult<Pet>> handler);
9595

9696
default Future<Pet> getPetById(@javax.annotation.Nonnull Long petId, ApiClient.AuthInfo authInfo){
9797
Promise<Pet> promise = Promise.promise();
98-
getPetById(petId, authInfo, promise);
98+
getPetById(petId, authInfo, promise::handle);
9999
return promise.future();
100100
}
101101

102102
void updatePet(@javax.annotation.Nonnull Pet pet, Handler<AsyncResult<Void>> handler);
103103

104104
default Future<Void> updatePet(@javax.annotation.Nonnull Pet pet){
105105
Promise<Void> promise = Promise.promise();
106-
updatePet(pet, promise);
106+
updatePet(pet, promise::handle);
107107
return promise.future();
108108
}
109109

110110
void updatePet(@javax.annotation.Nonnull Pet pet, ApiClient.AuthInfo authInfo, Handler<AsyncResult<Void>> handler);
111111

112112
default Future<Void> updatePet(@javax.annotation.Nonnull Pet pet, ApiClient.AuthInfo authInfo){
113113
Promise<Void> promise = Promise.promise();
114-
updatePet(pet, authInfo, promise);
114+
updatePet(pet, authInfo, promise::handle);
115115
return promise.future();
116116
}
117117

118118
void updatePetWithForm(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status, Handler<AsyncResult<Void>> handler);
119119

120120
default Future<Void> updatePetWithForm(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status){
121121
Promise<Void> promise = Promise.promise();
122-
updatePetWithForm(petId, name, status, promise);
122+
updatePetWithForm(petId, name, status, promise::handle);
123123
return promise.future();
124124
}
125125

126126
void updatePetWithForm(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status, ApiClient.AuthInfo authInfo, Handler<AsyncResult<Void>> handler);
127127

128128
default Future<Void> updatePetWithForm(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status, ApiClient.AuthInfo authInfo){
129129
Promise<Void> promise = Promise.promise();
130-
updatePetWithForm(petId, name, status, authInfo, promise);
130+
updatePetWithForm(petId, name, status, authInfo, promise::handle);
131131
return promise.future();
132132
}
133133

134134
void uploadFile(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable AsyncFile _file, Handler<AsyncResult<ModelApiResponse>> handler);
135135

136136
default Future<ModelApiResponse> uploadFile(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable AsyncFile _file){
137137
Promise<ModelApiResponse> promise = Promise.promise();
138-
uploadFile(petId, additionalMetadata, _file, promise);
138+
uploadFile(petId, additionalMetadata, _file, promise::handle);
139139
return promise.future();
140140
}
141141

142142
void uploadFile(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable AsyncFile _file, ApiClient.AuthInfo authInfo, Handler<AsyncResult<ModelApiResponse>> handler);
143143

144144
default Future<ModelApiResponse> uploadFile(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable AsyncFile _file, ApiClient.AuthInfo authInfo){
145145
Promise<ModelApiResponse> promise = Promise.promise();
146-
uploadFile(petId, additionalMetadata, _file, authInfo, promise);
146+
uploadFile(petId, additionalMetadata, _file, authInfo, promise::handle);
147147
return promise.future();
148148
}
149149

150150
void uploadFileWithRequiredFile(@javax.annotation.Nonnull Long petId, @javax.annotation.Nonnull AsyncFile requiredFile, @javax.annotation.Nullable String additionalMetadata, Handler<AsyncResult<ModelApiResponse>> handler);
151151

152152
default Future<ModelApiResponse> uploadFileWithRequiredFile(@javax.annotation.Nonnull Long petId, @javax.annotation.Nonnull AsyncFile requiredFile, @javax.annotation.Nullable String additionalMetadata){
153153
Promise<ModelApiResponse> promise = Promise.promise();
154-
uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata, promise);
154+
uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata, promise::handle);
155155
return promise.future();
156156
}
157157

158158
void uploadFileWithRequiredFile(@javax.annotation.Nonnull Long petId, @javax.annotation.Nonnull AsyncFile requiredFile, @javax.annotation.Nullable String additionalMetadata, ApiClient.AuthInfo authInfo, Handler<AsyncResult<ModelApiResponse>> handler);
159159

160160
default Future<ModelApiResponse> uploadFileWithRequiredFile(@javax.annotation.Nonnull Long petId, @javax.annotation.Nonnull AsyncFile requiredFile, @javax.annotation.Nullable String additionalMetadata, ApiClient.AuthInfo authInfo){
161161
Promise<ModelApiResponse> promise = Promise.promise();
162-
uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata, authInfo, promise);
162+
uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata, authInfo, promise::handle);
163163
return promise.future();
164164
}
165165

samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/StoreApi.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,63 +16,63 @@ public interface StoreApi {
1616

1717
default Future<Void> deleteOrder(@javax.annotation.Nonnull String orderId){
1818
Promise<Void> promise = Promise.promise();
19-
deleteOrder(orderId, promise);
19+
deleteOrder(orderId, promise::handle);
2020
return promise.future();
2121
}
2222

2323
void deleteOrder(@javax.annotation.Nonnull String orderId, ApiClient.AuthInfo authInfo, Handler<AsyncResult<Void>> handler);
2424

2525
default Future<Void> deleteOrder(@javax.annotation.Nonnull String orderId, ApiClient.AuthInfo authInfo){
2626
Promise<Void> promise = Promise.promise();
27-
deleteOrder(orderId, authInfo, promise);
27+
deleteOrder(orderId, authInfo, promise::handle);
2828
return promise.future();
2929
}
3030

3131
void getInventory(Handler<AsyncResult<Map<String, Integer>>> handler);
3232

3333
default Future<Map<String, Integer>> getInventory(){
3434
Promise<Map<String, Integer>> promise = Promise.promise();
35-
getInventory(promise);
35+
getInventory(promise::handle);
3636
return promise.future();
3737
}
3838

3939
void getInventory(ApiClient.AuthInfo authInfo, Handler<AsyncResult<Map<String, Integer>>> handler);
4040

4141
default Future<Map<String, Integer>> getInventory(ApiClient.AuthInfo authInfo){
4242
Promise<Map<String, Integer>> promise = Promise.promise();
43-
getInventory(authInfo, promise);
43+
getInventory(authInfo, promise::handle);
4444
return promise.future();
4545
}
4646

4747
void getOrderById(@javax.annotation.Nonnull Long orderId, Handler<AsyncResult<Order>> handler);
4848

4949
default Future<Order> getOrderById(@javax.annotation.Nonnull Long orderId){
5050
Promise<Order> promise = Promise.promise();
51-
getOrderById(orderId, promise);
51+
getOrderById(orderId, promise::handle);
5252
return promise.future();
5353
}
5454

5555
void getOrderById(@javax.annotation.Nonnull Long orderId, ApiClient.AuthInfo authInfo, Handler<AsyncResult<Order>> handler);
5656

5757
default Future<Order> getOrderById(@javax.annotation.Nonnull Long orderId, ApiClient.AuthInfo authInfo){
5858
Promise<Order> promise = Promise.promise();
59-
getOrderById(orderId, authInfo, promise);
59+
getOrderById(orderId, authInfo, promise::handle);
6060
return promise.future();
6161
}
6262

6363
void placeOrder(@javax.annotation.Nonnull Order order, Handler<AsyncResult<Order>> handler);
6464

6565
default Future<Order> placeOrder(@javax.annotation.Nonnull Order order){
6666
Promise<Order> promise = Promise.promise();
67-
placeOrder(order, promise);
67+
placeOrder(order, promise::handle);
6868
return promise.future();
6969
}
7070

7171
void placeOrder(@javax.annotation.Nonnull Order order, ApiClient.AuthInfo authInfo, Handler<AsyncResult<Order>> handler);
7272

7373
default Future<Order> placeOrder(@javax.annotation.Nonnull Order order, ApiClient.AuthInfo authInfo){
7474
Promise<Order> promise = Promise.promise();
75-
placeOrder(order, authInfo, promise);
75+
placeOrder(order, authInfo, promise::handle);
7676
return promise.future();
7777
}
7878

0 commit comments

Comments
 (0)