Skip to content

Commit 67c96ca

Browse files
added generated files
1 parent 58d1498 commit 67c96ca

File tree

39 files changed

+275
-265
lines changed

39 files changed

+275
-265
lines changed

docs/generators/java-microprofile.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
105105
|useRxJava3|Whether to use the RxJava3 adapter with the retrofit2 library. IMPORTANT: This option has been deprecated.| |false|
106106
|useSealedOneOfInterfaces|Generate the oneOf interfaces as sealed interfaces. Only supported for WebClient and RestClient.| |false|
107107
|useSingleRequestParameter|Setting this property to "true" will generate functions with a single argument containing all API endpoint parameters instead of one argument per parameter. ONLY native, jersey2, jersey3, okhttp-gson, microprofile, Spring RestClient, Spring WebClient support this option. Setting this property to "static" does the same as "true", but also makes the generated arguments class static with single parameter instantiation.| |false|
108+
|useUnaryInterceptor|If true it will generate ResponseInterceptors using a UnaryOperator. This can be usefull for manipulating the request before it gets passed, for example doing your own decryption| |true|
108109
|webclientBlockingOperations|Making all WebClient operations blocking(sync). Note that if on operation 'x-webclient-blocking: false' then such operation won't be sync| |false|
109110
|withAWSV4Signature|whether to include AWS v4 signature support (only available for okhttp-gson library)| |false|
110111
|withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false|

docs/generators/java.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ These options may be applied as additional-properties (cli) or configOptions (pl
104104
|useRxJava2|Whether to use the RxJava2 adapter with the retrofit2 library. IMPORTANT: This option has been deprecated.| |false|
105105
|useRxJava3|Whether to use the RxJava3 adapter with the retrofit2 library. IMPORTANT: This option has been deprecated.| |false|
106106
|useSealedOneOfInterfaces|Generate the oneOf interfaces as sealed interfaces. Only supported for WebClient and RestClient.| |false|
107-
|useUnaryInterceptor|Specify if the ResponseInterceptor should be able to change the request before beeing returned| |false|
108107
|useSingleRequestParameter|Setting this property to "true" will generate functions with a single argument containing all API endpoint parameters instead of one argument per parameter. ONLY native, jersey2, jersey3, okhttp-gson, microprofile, Spring RestClient, Spring WebClient support this option. Setting this property to "static" does the same as "true", but also makes the generated arguments class static with single parameter instantiation.| |false|
108+
|useUnaryInterceptor|If true it will generate ResponseInterceptors using a UnaryOperator. This can be usefull for manipulating the request before it gets passed, for example doing your own decryption| |true|
109109
|webclientBlockingOperations|Making all WebClient operations blocking(sync). Note that if on operation 'x-webclient-blocking: false' then such operation won't be sync| |false|
110110
|withAWSV4Signature|whether to include AWS v4 signature support (only available for okhttp-gson library)| |false|
111111
|withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false|

samples/client/echo_api/java/native/src/main/java/org/openapitools/client/ApiClient.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
import java.util.Optional;
3939
import java.util.zip.GZIPInputStream;
4040
import java.util.stream.Collectors;
41-
41+
import java.util.function.UnaryOperator;
4242
import static java.nio.charset.StandardCharsets.UTF_8;
4343

4444
/**
@@ -64,8 +64,9 @@ public class ApiClient {
6464
protected int port;
6565
protected String basePath;
6666
protected Consumer<HttpRequest.Builder> interceptor;
67-
protected Consumer<HttpResponse<InputStream>> responseInterceptor;
68-
protected Consumer<HttpResponse<InputStream>> asyncResponseInterceptor;
67+
protected UnaryOperator<HttpResponse<InputStream>> responseInterceptor;
68+
protected UnaryOperator<HttpResponse<InputStream>> asyncResponseInterceptor;
69+
6970
protected Duration readTimeout;
7071
protected Duration connectTimeout;
7172

@@ -359,12 +360,12 @@ public Consumer<HttpRequest.Builder> getRequestInterceptor() {
359360
* Set a custom response interceptor.
360361
*
361362
* <p>This is useful for logging, monitoring or extraction of header variables</p>
362-
*
363+
* <p>If you are using the UnaryInterceptor you can even manipulate the response to a certain degree</p>
363364
* @param interceptor A function invoked before creating each request. A value
364365
* of null resets the interceptor to a no-op.
365366
* @return This object.
366367
*/
367-
public ApiClient setResponseInterceptor(Consumer<HttpResponse<InputStream>> interceptor) {
368+
public ApiClient setResponseInterceptor(UnaryOperator<HttpResponse<InputStream>> interceptor) {
368369
this.responseInterceptor = interceptor;
369370
return this;
370371
}
@@ -374,20 +375,20 @@ public ApiClient setResponseInterceptor(Consumer<HttpResponse<InputStream>> inte
374375
*
375376
* @return The custom interceptor that was set, or null if there isn't any.
376377
*/
377-
public Consumer<HttpResponse<InputStream>> getResponseInterceptor() {
378+
public UnaryOperator<HttpResponse<InputStream>> getResponseInterceptor() {
378379
return responseInterceptor;
379380
}
380381

381382
/**
382383
* Set a custom async response interceptor. Use this interceptor when asyncNative is set to 'true'.
383384
*
384385
* <p>This is useful for logging, monitoring or extraction of header variables</p>
385-
*
386+
* <p>If you are using the UnaryInterceptor you can even manipulate the response to a certain degree</p>
386387
* @param interceptor A function invoked before creating each request. A value
387388
* of null resets the interceptor to a no-op.
388389
* @return This object.
389390
*/
390-
public ApiClient setAsyncResponseInterceptor(Consumer<HttpResponse<InputStream>> interceptor) {
391+
public ApiClient setAsyncResponseInterceptor(UnaryOperator<HttpResponse<InputStream>> interceptor) {
391392
this.asyncResponseInterceptor = interceptor;
392393
return this;
393394
}
@@ -397,7 +398,7 @@ public ApiClient setAsyncResponseInterceptor(Consumer<HttpResponse<InputStream>>
397398
*
398399
* @return The custom interceptor that was set, or null if there isn't any.
399400
*/
400-
public Consumer<HttpResponse<InputStream>> getAsyncResponseInterceptor() {
401+
public UnaryOperator<HttpResponse<InputStream>> getAsyncResponseInterceptor() {
401402
return asyncResponseInterceptor;
402403
}
403404

samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/AuthApi.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
import java.util.Map;
4444
import java.util.Set;
4545
import java.util.Locale;
46+
import java.util.function.UnaryOperator;
4647
import java.util.function.Consumer;
4748

4849
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.18.0-SNAPSHOT")
@@ -72,8 +73,8 @@ static HttpRequest.Builder withAdditionalHeaders(HttpRequest.Builder builder, Ma
7273
private final String memberVarBaseUri;
7374
private final Consumer<HttpRequest.Builder> memberVarInterceptor;
7475
private final Duration memberVarReadTimeout;
75-
private final Consumer<HttpResponse<InputStream>> memberVarResponseInterceptor;
76-
private final Consumer<HttpResponse<InputStream>> memberVarAsyncResponseInterceptor;
76+
private final UnaryOperator<HttpResponse<InputStream>> memberVarResponseInterceptor;
77+
private final UnaryOperator<HttpResponse<InputStream>> memberVarAsyncResponseInterceptor;
7778

7879
public AuthApi() {
7980
this(Configuration.getDefaultApiClient());
@@ -208,7 +209,7 @@ public ApiResponse<String> testAuthHttpBasicWithHttpInfo(Map<String, String> hea
208209
localVarRequestBuilder.build(),
209210
HttpResponse.BodyHandlers.ofInputStream());
210211
if (memberVarResponseInterceptor != null) {
211-
memberVarResponseInterceptor.accept(localVarResponse);
212+
localVarResponse = memberVarResponseInterceptor.apply(localVarResponse);
212213
}
213214
InputStream localVarResponseBody = null;
214215
try {
@@ -311,7 +312,7 @@ public ApiResponse<String> testAuthHttpBearerWithHttpInfo(Map<String, String> he
311312
localVarRequestBuilder.build(),
312313
HttpResponse.BodyHandlers.ofInputStream());
313314
if (memberVarResponseInterceptor != null) {
314-
memberVarResponseInterceptor.accept(localVarResponse);
315+
localVarResponse = memberVarResponseInterceptor.apply(localVarResponse);
315316
}
316317
InputStream localVarResponseBody = null;
317318
try {

samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/BodyApi.java

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
import java.util.Map;
5454
import java.util.Set;
5555
import java.util.Locale;
56+
import java.util.function.UnaryOperator;
5657
import java.util.function.Consumer;
5758

5859
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.18.0-SNAPSHOT")
@@ -82,8 +83,8 @@ static HttpRequest.Builder withAdditionalHeaders(HttpRequest.Builder builder, Ma
8283
private final String memberVarBaseUri;
8384
private final Consumer<HttpRequest.Builder> memberVarInterceptor;
8485
private final Duration memberVarReadTimeout;
85-
private final Consumer<HttpResponse<InputStream>> memberVarResponseInterceptor;
86-
private final Consumer<HttpResponse<InputStream>> memberVarAsyncResponseInterceptor;
86+
private final UnaryOperator<HttpResponse<InputStream>> memberVarResponseInterceptor;
87+
private final UnaryOperator<HttpResponse<InputStream>> memberVarAsyncResponseInterceptor;
8788

8889
public BodyApi() {
8990
this(Configuration.getDefaultApiClient());
@@ -218,7 +219,7 @@ public ApiResponse<File> testBinaryGifWithHttpInfo(Map<String, String> headers)
218219
localVarRequestBuilder.build(),
219220
HttpResponse.BodyHandlers.ofInputStream());
220221
if (memberVarResponseInterceptor != null) {
221-
memberVarResponseInterceptor.accept(localVarResponse);
222+
localVarResponse = memberVarResponseInterceptor.apply(localVarResponse);
222223
}
223224
InputStream localVarResponseBody = null;
224225
try {
@@ -330,7 +331,7 @@ public ApiResponse<String> testBodyApplicationOctetstreamBinaryWithHttpInfo(@jav
330331
localVarRequestBuilder.build(),
331332
HttpResponse.BodyHandlers.ofInputStream());
332333
if (memberVarResponseInterceptor != null) {
333-
memberVarResponseInterceptor.accept(localVarResponse);
334+
localVarResponse = memberVarResponseInterceptor.apply(localVarResponse);
334335
}
335336
InputStream localVarResponseBody = null;
336337
try {
@@ -443,7 +444,7 @@ public ApiResponse<String> testBodyMultipartFormdataArrayOfBinaryWithHttpInfo(@j
443444
localVarRequestBuilder.build(),
444445
HttpResponse.BodyHandlers.ofInputStream());
445446
if (memberVarResponseInterceptor != null) {
446-
memberVarResponseInterceptor.accept(localVarResponse);
447+
localVarResponse = memberVarResponseInterceptor.apply(localVarResponse);
447448
}
448449
InputStream localVarResponseBody = null;
449450
try {
@@ -590,7 +591,7 @@ public ApiResponse<String> testBodyMultipartFormdataSingleBinaryWithHttpInfo(@ja
590591
localVarRequestBuilder.build(),
591592
HttpResponse.BodyHandlers.ofInputStream());
592593
if (memberVarResponseInterceptor != null) {
593-
memberVarResponseInterceptor.accept(localVarResponse);
594+
localVarResponse = memberVarResponseInterceptor.apply(localVarResponse);
594595
}
595596
InputStream localVarResponseBody = null;
596597
try {
@@ -731,7 +732,7 @@ public ApiResponse<Pet> testEchoBodyAllOfPetWithHttpInfo(@javax.annotation.Nulla
731732
localVarRequestBuilder.build(),
732733
HttpResponse.BodyHandlers.ofInputStream());
733734
if (memberVarResponseInterceptor != null) {
734-
memberVarResponseInterceptor.accept(localVarResponse);
735+
localVarResponse = memberVarResponseInterceptor.apply(localVarResponse);
735736
}
736737
InputStream localVarResponseBody = null;
737738
try {
@@ -850,7 +851,7 @@ public ApiResponse<String> testEchoBodyFreeFormObjectResponseStringWithHttpInfo(
850851
localVarRequestBuilder.build(),
851852
HttpResponse.BodyHandlers.ofInputStream());
852853
if (memberVarResponseInterceptor != null) {
853-
memberVarResponseInterceptor.accept(localVarResponse);
854+
localVarResponse = memberVarResponseInterceptor.apply(localVarResponse);
854855
}
855856
InputStream localVarResponseBody = null;
856857
try {
@@ -963,7 +964,7 @@ public ApiResponse<Pet> testEchoBodyPetWithHttpInfo(@javax.annotation.Nullable P
963964
localVarRequestBuilder.build(),
964965
HttpResponse.BodyHandlers.ofInputStream());
965966
if (memberVarResponseInterceptor != null) {
966-
memberVarResponseInterceptor.accept(localVarResponse);
967+
localVarResponse = memberVarResponseInterceptor.apply(localVarResponse);
967968
}
968969
InputStream localVarResponseBody = null;
969970
try {
@@ -1082,7 +1083,7 @@ public ApiResponse<String> testEchoBodyPetResponseStringWithHttpInfo(@javax.anno
10821083
localVarRequestBuilder.build(),
10831084
HttpResponse.BodyHandlers.ofInputStream());
10841085
if (memberVarResponseInterceptor != null) {
1085-
memberVarResponseInterceptor.accept(localVarResponse);
1086+
localVarResponse = memberVarResponseInterceptor.apply(localVarResponse);
10861087
}
10871088
InputStream localVarResponseBody = null;
10881089
try {
@@ -1195,7 +1196,7 @@ public ApiResponse<StringEnumRef> testEchoBodyStringEnumWithHttpInfo(@javax.anno
11951196
localVarRequestBuilder.build(),
11961197
HttpResponse.BodyHandlers.ofInputStream());
11971198
if (memberVarResponseInterceptor != null) {
1198-
memberVarResponseInterceptor.accept(localVarResponse);
1199+
localVarResponse = memberVarResponseInterceptor.apply(localVarResponse);
11991200
}
12001201
InputStream localVarResponseBody = null;
12011202
try {
@@ -1314,7 +1315,7 @@ public ApiResponse<String> testEchoBodyTagResponseStringWithHttpInfo(@javax.anno
13141315
localVarRequestBuilder.build(),
13151316
HttpResponse.BodyHandlers.ofInputStream());
13161317
if (memberVarResponseInterceptor != null) {
1317-
memberVarResponseInterceptor.accept(localVarResponse);
1318+
localVarResponse = memberVarResponseInterceptor.apply(localVarResponse);
13181319
}
13191320
InputStream localVarResponseBody = null;
13201321
try {

samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/FormApi.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
import java.util.Map;
5151
import java.util.Set;
5252
import java.util.Locale;
53+
import java.util.function.UnaryOperator;
5354
import java.util.function.Consumer;
5455

5556
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.18.0-SNAPSHOT")
@@ -79,8 +80,8 @@ static HttpRequest.Builder withAdditionalHeaders(HttpRequest.Builder builder, Ma
7980
private final String memberVarBaseUri;
8081
private final Consumer<HttpRequest.Builder> memberVarInterceptor;
8182
private final Duration memberVarReadTimeout;
82-
private final Consumer<HttpResponse<InputStream>> memberVarResponseInterceptor;
83-
private final Consumer<HttpResponse<InputStream>> memberVarAsyncResponseInterceptor;
83+
private final UnaryOperator<HttpResponse<InputStream>> memberVarResponseInterceptor;
84+
private final UnaryOperator<HttpResponse<InputStream>> memberVarAsyncResponseInterceptor;
8485

8586
public FormApi() {
8687
this(Configuration.getDefaultApiClient());
@@ -227,7 +228,7 @@ public ApiResponse<String> testFormIntegerBooleanStringWithHttpInfo(@javax.annot
227228
localVarRequestBuilder.build(),
228229
HttpResponse.BodyHandlers.ofInputStream());
229230
if (memberVarResponseInterceptor != null) {
230-
memberVarResponseInterceptor.accept(localVarResponse);
231+
localVarResponse = memberVarResponseInterceptor.apply(localVarResponse);
231232
}
232233
InputStream localVarResponseBody = null;
233234
try {
@@ -355,7 +356,7 @@ public ApiResponse<String> testFormObjectMultipartWithHttpInfo(@javax.annotation
355356
localVarRequestBuilder.build(),
356357
HttpResponse.BodyHandlers.ofInputStream());
357358
if (memberVarResponseInterceptor != null) {
358-
memberVarResponseInterceptor.accept(localVarResponse);
359+
localVarResponse = memberVarResponseInterceptor.apply(localVarResponse);
359360
}
360361
InputStream localVarResponseBody = null;
361362
try {
@@ -521,7 +522,7 @@ public ApiResponse<String> testFormOneofWithHttpInfo(@javax.annotation.Nullable
521522
localVarRequestBuilder.build(),
522523
HttpResponse.BodyHandlers.ofInputStream());
523524
if (memberVarResponseInterceptor != null) {
524-
memberVarResponseInterceptor.accept(localVarResponse);
525+
localVarResponse = memberVarResponseInterceptor.apply(localVarResponse);
525526
}
526527
InputStream localVarResponseBody = null;
527528
try {

samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/HeaderApi.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
import java.util.Map;
5151
import java.util.Set;
5252
import java.util.Locale;
53+
import java.util.function.UnaryOperator;
5354
import java.util.function.Consumer;
5455

5556
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.18.0-SNAPSHOT")
@@ -79,8 +80,8 @@ static HttpRequest.Builder withAdditionalHeaders(HttpRequest.Builder builder, Ma
7980
private final String memberVarBaseUri;
8081
private final Consumer<HttpRequest.Builder> memberVarInterceptor;
8182
private final Duration memberVarReadTimeout;
82-
private final Consumer<HttpResponse<InputStream>> memberVarResponseInterceptor;
83-
private final Consumer<HttpResponse<InputStream>> memberVarAsyncResponseInterceptor;
83+
private final UnaryOperator<HttpResponse<InputStream>> memberVarResponseInterceptor;
84+
private final UnaryOperator<HttpResponse<InputStream>> memberVarAsyncResponseInterceptor;
8485

8586
public HeaderApi() {
8687
this(Configuration.getDefaultApiClient());
@@ -235,7 +236,7 @@ public ApiResponse<String> testHeaderIntegerBooleanStringEnumsWithHttpInfo(@java
235236
localVarRequestBuilder.build(),
236237
HttpResponse.BodyHandlers.ofInputStream());
237238
if (memberVarResponseInterceptor != null) {
238-
memberVarResponseInterceptor.accept(localVarResponse);
239+
localVarResponse = memberVarResponseInterceptor.apply(localVarResponse);
239240
}
240241
InputStream localVarResponseBody = null;
241242
try {

samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/PathApi.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
import java.util.Map;
5151
import java.util.Set;
5252
import java.util.Locale;
53+
import java.util.function.UnaryOperator;
5354
import java.util.function.Consumer;
5455

5556
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.18.0-SNAPSHOT")
@@ -79,8 +80,8 @@ static HttpRequest.Builder withAdditionalHeaders(HttpRequest.Builder builder, Ma
7980
private final String memberVarBaseUri;
8081
private final Consumer<HttpRequest.Builder> memberVarInterceptor;
8182
private final Duration memberVarReadTimeout;
82-
private final Consumer<HttpResponse<InputStream>> memberVarResponseInterceptor;
83-
private final Consumer<HttpResponse<InputStream>> memberVarAsyncResponseInterceptor;
83+
private final UnaryOperator<HttpResponse<InputStream>> memberVarResponseInterceptor;
84+
private final UnaryOperator<HttpResponse<InputStream>> memberVarAsyncResponseInterceptor;
8485

8586
public PathApi() {
8687
this(Configuration.getDefaultApiClient());
@@ -231,7 +232,7 @@ public ApiResponse<String> testsPathStringPathStringIntegerPathIntegerEnumNonref
231232
localVarRequestBuilder.build(),
232233
HttpResponse.BodyHandlers.ofInputStream());
233234
if (memberVarResponseInterceptor != null) {
234-
memberVarResponseInterceptor.accept(localVarResponse);
235+
localVarResponse = memberVarResponseInterceptor.apply(localVarResponse);
235236
}
236237
InputStream localVarResponseBody = null;
237238
try {

0 commit comments

Comments
 (0)