Skip to content

Commit b0be92a

Browse files
committed
fix(java) address review comments
- add missing 7.14->7.15 changes - rm misplaced `{` - use custom ApiException
1 parent f2c6869 commit b0be92a

3 files changed

Lines changed: 16 additions & 16 deletions

File tree

languages/java/templates/ApiClient.mustache

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ public class ApiClient {
268268
}
269269
}
270270
RetryingOAuth retryingOAuth = new RetryingOAuth(tokenUrl, clientId, OAuthFlow.{{#lambda.uppercase}}{{#lambda.snakecase}}{{flow}}{{/lambda.snakecase}}{{/lambda.uppercase}}, clientSecret, parameters);
271-
{authentications.put(
271+
authentications.put(
272272
"{{name}}",
273273
retryingOAuth
274274
);
@@ -1091,7 +1091,7 @@ public class ApiClient {
10911091
* @param response HTTP response
10921092
* @param returnType The type of the Java object
10931093
* @return The deserialized Java object
1094-
* @throws {{invokerPackage}}.ApiException If fail to deserialize response body, i.e. cannot read response body
1094+
* @throws cloud.stackit.sdk.core.exception.ApiException If fail to deserialize response body, i.e. cannot read response body
10951095
* or the Content-Type of the response is not supported.
10961096
*/
10971097
@SuppressWarnings("unchecked")
@@ -1161,7 +1161,7 @@ public class ApiClient {
11611161
* @param obj The Java object
11621162
* @param contentType The request Content-Type
11631163
* @return The serialized request body
1164-
* @throws {{invokerPackage}}.ApiException If fail to serialize the given object
1164+
* @throws cloud.stackit.sdk.core.exception.ApiException If fail to serialize the given object
11651165
*/
11661166
public RequestBody serialize(Object obj, String contentType) throws ApiException {
11671167
if (obj instanceof byte[]) {
@@ -1191,7 +1191,7 @@ public class ApiClient {
11911191
* Download file from the given response.
11921192
*
11931193
* @param response An instance of the Response object
1194-
* @throws {{invokerPackage}}.ApiException If fail to read file content from response and write to disk
1194+
* @throws cloud.stackit.sdk.core.exception.ApiException If fail to read file content from response and write to disk
11951195
* @return Downloaded file
11961196
*/
11971197
public File downloadFileFromResponse(Response response) throws ApiException {
@@ -1255,7 +1255,7 @@ public class ApiClient {
12551255
* @param <T> Type
12561256
* @param call An instance of the Call object
12571257
* @return ApiResponse&lt;T&gt;
1258-
* @throws {{invokerPackage}}.ApiException If fail to execute the call
1258+
* @throws cloud.stackit.sdk.core.exception.ApiException If fail to execute the call
12591259
*/
12601260
public <T> ApiResponse<T> execute(Call call) throws ApiException {
12611261
return execute(call, null);
@@ -1270,7 +1270,7 @@ public class ApiClient {
12701270
* @return ApiResponse object containing response status, headers and
12711271
* data, which is a Java object deserialized from response body and would be null
12721272
* when returnType is null.
1273-
* @throws {{invokerPackage}}.ApiException If fail to execute the call
1273+
* @throws cloud.stackit.sdk.core.exception.ApiException If fail to execute the call
12741274
*/
12751275
public <T> ApiResponse<T> execute(Call call, Type returnType) throws ApiException {
12761276
try {
@@ -1289,7 +1289,7 @@ public class ApiClient {
12891289
* @param call a {@link okhttp3.Call} object
12901290
* @param returnType a {@link java.lang.reflect.Type} object
12911291
* @return a {@link java.io.InputStream} object
1292-
* @throws {{invokerPackage}}.ApiException if any.
1292+
* @throws cloud.stackit.sdk.core.exception.ApiException if any.
12931293
*/
12941294
public InputStream executeStream(Call call, Type returnType) throws ApiException {
12951295
try {
@@ -1359,7 +1359,7 @@ public class ApiClient {
13591359
* @param response Response
13601360
* @param returnType Return type
13611361
* @return Type
1362-
* @throws {{invokerPackage}}.ApiException If the response has an unsuccessful status code or
1362+
* @throws cloud.stackit.sdk.core.exception.ApiException If the response has an unsuccessful status code or
13631363
* fail to deserialize the response body
13641364
*/
13651365
public <T> T handleResponse(Response response, Type returnType) throws ApiException {
@@ -1406,7 +1406,7 @@ public class ApiClient {
14061406
* @param authNames The authentications to apply
14071407
* @param callback Callback for upload/download progress
14081408
* @return The HTTP call
1409-
* @throws {{invokerPackage}}.ApiException If fail to serialize the request body object
1409+
* @throws cloud.stackit.sdk.core.exception.ApiException If fail to serialize the request body object
14101410
*/
14111411
public Call buildCall(String baseUrl, String path, String method, List<Pair> queryParams, List<Pair> collectionQueryParams, Object body, Map<String, String> headerParams, Map<String, String> cookieParams, Map<String, Object> formParams, String[] authNames, ApiCallback callback) throws ApiException {
14121412
Request request = buildRequest(baseUrl, path, method, queryParams, collectionQueryParams, body, headerParams, cookieParams, formParams, authNames, callback);
@@ -1429,7 +1429,7 @@ public class ApiClient {
14291429
* @param authNames The authentications to apply
14301430
* @param callback Callback for upload/download progress
14311431
* @return The HTTP request
1432-
* @throws {{invokerPackage}}.ApiException If fail to serialize the request body object
1432+
* @throws cloud.stackit.sdk.core.exception.ApiException If fail to serialize the request body object
14331433
*/
14341434
public Request buildRequest(String baseUrl, String path, String method, List<Pair> queryParams, List<Pair> collectionQueryParams, Object body, Map<String, String> headerParams, Map<String, String> cookieParams, Map<String, Object> formParams, String[] authNames, ApiCallback callback) throws ApiException {
14351435
final String url = buildUrl(baseUrl, path, queryParams, collectionQueryParams);
@@ -1866,7 +1866,7 @@ public class ApiClient {
18661866
*
18671867
* @param requestBody The HTTP request object
18681868
* @return The string representation of the HTTP request body
1869-
* @throws {{invokerPackage}}.ApiException If fail to serialize the request body object into a string
1869+
* @throws cloud.stackit.sdk.core.exception.ApiException If fail to serialize the request body object into a string
18701870
*/
18711871
protected String requestBodyToString(RequestBody requestBody) throws ApiException {
18721872
if (requestBody != null) {

languages/java/templates/api.mustache

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{{! This template was customized to initialize the DefaultApi with the CoreConfiguration to easily setup the KeyFlow Authentication and custom endpoints. }}
2-
{{! Original template: https://github.com/OpenAPITools/openapi-generator/blob/v7.14.0/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/api.mustache }}
2+
{{! Original template: https://github.com/OpenAPITools/openapi-generator/blob/v7.19.0/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/api.mustache }}
33

44
{{>licenseInfo}}
55

@@ -478,11 +478,11 @@ class {{classname}} {
478478

479479
public class API{{operationId}}Request {
480480
{{#requiredParams}}
481-
{{>nullable_var_annotations}}
481+
{{>nullable_var_annotations}}{{! prevent indent}}
482482
private final {{{dataType}}} {{paramName}};
483483
{{/requiredParams}}
484484
{{#optionalParams}}
485-
{{>nullable_var_annotations}}
485+
{{>nullable_var_annotations}}{{! prevent indent}}
486486
private {{{dataType}}} {{paramName}};
487487
{{/optionalParams}}
488488

languages/java/templates/build.gradle.mustache

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{{! This template was customized to allow the services to be a subprojects in one big gradle project. }}
2-
{{! Original template: https://github.com/OpenAPITools/openapi-generator/blob/v7.14.0/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/build.gradle.mustache }}
2+
{{! Original template: https://github.com/OpenAPITools/openapi-generator/blob/v7.19.0/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/build.gradle.mustache }}
33

44
ext {
55
{{#swagger1AnnotationLibrary}}
@@ -36,7 +36,7 @@ dependencies {
3636
{{#hasOAuthMethods}}
3737
implementation group: 'org.apache.oltu.oauth2', name: 'org.apache.oltu.oauth2.client', version: '1.0.2'
3838
{{/hasOAuthMethods}}
39-
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.17.0'
39+
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.18.0'
4040
{{#joda}}
4141
implementation 'joda-time:joda-time:2.9.9'
4242
{{/joda}}

0 commit comments

Comments
 (0)