Skip to content

Commit b46c7ae

Browse files
[Java v1 SDK] Upgrades OpenAPI Generator from 7.12.0 to 7.26.0 (#584)
2 parents db05a7a + e7f6b84 commit b46c7ae

271 files changed

Lines changed: 3527 additions & 3584 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.

‎sdks/java-v1/build.gradle‎

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,16 @@ repositories {
2222
mavenCentral()
2323
}
2424

25+
ext {
26+
jackson_version = "2.21.6"
27+
jackson_annotations_version = "2.21"
28+
jackson_databind_version = "2.21.6"
29+
jakarta_annotation_version = "1.3.5"
30+
jersey_version = "2.35"
31+
junit_version = "5.8.2"
32+
mockito_version = "3.12.4"
33+
}
34+
2535
tasks.withType(JavaCompile).configureEach {
2636
options.encoding = 'UTF-8'
2737
}
@@ -57,18 +67,7 @@ artifacts {
5767
archives javadocJar, sourcesJar, fatJar
5868
}
5969

60-
ext {
61-
swagger_annotations_version = "1.6.5"
62-
jackson_version = "2.17.1"
63-
jackson_databind_version = "2.17.1"
64-
jakarta_annotation_version = "1.3.5"
65-
jersey_version = "2.35"
66-
junit_version = "5.8.2"
67-
mockito_version = "3.12.4"
68-
}
69-
7070
dependencies {
71-
implementation "io.swagger:swagger-annotations:$swagger_annotations_version"
7271
implementation 'commons-codec:commons-codec:1.15'
7372
implementation "com.google.code.findbugs:jsr305:3.0.2"
7473
implementation "org.glassfish.jersey.core:jersey-client:$jersey_version"
@@ -77,7 +76,7 @@ dependencies {
7776
implementation "org.glassfish.jersey.media:jersey-media-json-jackson:$jersey_version"
7877
implementation "org.glassfish.jersey.connectors:jersey-apache-connector:$jersey_version"
7978
implementation "com.fasterxml.jackson.core:jackson-core:$jackson_version"
80-
implementation "com.fasterxml.jackson.core:jackson-annotations:$jackson_version"
79+
implementation "com.fasterxml.jackson.core:jackson-annotations:$jackson_annotations_version"
8180
implementation "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version"
8281
implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version"
8382
implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"

‎sdks/java-v1/build.sbt‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ lazy val root = (project in file(".")).
33
organization := "com.dropbox.sign",
44
name := "dropbox-sign",
55
version := "1.11-dev",
6-
scalaVersion := "2.11.4",
6+
scalaVersion := "2.11.12",
77
scalacOptions ++= Seq("-feature"),
88
Compile / javacOptions ++= Seq("-Xlint:deprecation"),
99
Compile / packageDoc / publishArtifact := false,
@@ -17,10 +17,10 @@ lazy val root = (project in file(".")).
1717
"org.glassfish.jersey.media" % "jersey-media-multipart" % "2.35",
1818
"org.glassfish.jersey.media" % "jersey-media-json-jackson" % "2.35",
1919
"org.glassfish.jersey.connectors" % "jersey-apache-connector" % "2.35",
20-
"com.fasterxml.jackson.core" % "jackson-core" % "2.17.1" % "compile",
21-
"com.fasterxml.jackson.core" % "jackson-annotations" % "2.17.1" % "compile",
22-
"com.fasterxml.jackson.core" % "jackson-databind" % "2.17.1" % "compile",
23-
"com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.17.1" % "compile",
20+
"com.fasterxml.jackson.core" % "jackson-core" % "2.21.6" % "compile",
21+
"com.fasterxml.jackson.core" % "jackson-annotations" % "2.21" % "compile",
22+
"com.fasterxml.jackson.core" % "jackson-databind" % "2.21.6" % "compile",
23+
"com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.21.6" % "compile",
2424
"jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile",
2525
"org.junit.jupiter" % "junit-jupiter-api" % "5.8.2" % "test"
2626
)

‎sdks/java-v1/gradle/wrapper/gradle-wrapper.properties‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.5-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

‎sdks/java-v1/pom.xml‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@
311311
<dependency>
312312
<groupId>com.fasterxml.jackson.core</groupId>
313313
<artifactId>jackson-annotations</artifactId>
314-
<version>${jackson-version}</version>
314+
<version>${jackson-annotations-version}</version>
315315
</dependency>
316316
<dependency>
317317
<groupId>com.fasterxml.jackson.core</groupId>
@@ -352,12 +352,13 @@
352352
<properties>
353353
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
354354
<jersey-version>2.37</jersey-version>
355-
<jackson-version>2.17.1</jackson-version>
356-
<jackson-databind-version>2.17.1</jackson-databind-version>
357-
<jackson-databind-nullable-version>0.2.6</jackson-databind-nullable-version>
355+
<jackson-version>2.21.6</jackson-version>
356+
<jackson-annotations-version>2.21</jackson-annotations-version>
357+
<jackson-databind-version>2.21.6</jackson-databind-version>
358+
<jackson-databind-nullable-version>0.2.12</jackson-databind-nullable-version>
358359
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
359360
<beanvalidation-version>2.0.2</beanvalidation-version>
360-
<junit-version>5.10.0</junit-version>
361+
<junit-version>5.14.4</junit-version>
361362
<spotless.version>2.21.0</spotless.version>
362363
<mockito.version>3.12.4</mockito.version>
363364
</properties>

‎sdks/java-v1/run-build‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22

3-
# see https://github.com/OpenAPITools/openapi-generator/tree/v7.8.0/modules/openapi-generator/src/main/resources/Java
3+
# see https://github.com/OpenAPITools/openapi-generator/tree/v7.26.0/modules/openapi-generator/src/main/resources/Java
44

55
set -e
66

@@ -18,7 +18,7 @@ rm -f "${DIR}/src/main/java/com/dropbox/sign/model/"*.java
1818

1919
docker run --rm \
2020
-v "${DIR}/:/local" \
21-
openapitools/openapi-generator-cli:v7.12.0 generate \
21+
openapitools/openapi-generator-cli:v7.26.0 generate \
2222
-i "/local/openapi-sdk.yaml" \
2323
-c "/local/openapi-config.yaml" \
2424
-t "/local/templates" \

‎sdks/java-v1/src/main/java/com/dropbox/sign/ApiClient.java‎

Lines changed: 71 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -71,16 +71,16 @@
7171
/** ApiClient class. */
7272
@javax.annotation.Generated(
7373
value = "org.openapitools.codegen.languages.JavaClientCodegen",
74-
comments = "Generator version: 7.12.0")
74+
comments = "Generator version: 7.26.0")
7575
public class ApiClient extends JavaTimeFormatter {
76-
private static final Pattern JSON_MIME_PATTERN =
76+
protected static final Pattern JSON_MIME_PATTERN =
7777
Pattern.compile("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
7878

7979
protected Map<String, String> defaultHeaderMap = new HashMap<>();
8080
protected Map<String, String> defaultCookieMap = new HashMap<>();
8181
protected String basePath = "https://api.hellosign.com/v3";
8282
protected String userAgent;
83-
private static final Logger log = Logger.getLogger(ApiClient.class.getName());
83+
protected static final Logger log = Logger.getLogger(ApiClient.class.getName());
8484

8585
protected List<ServerConfiguration> servers =
8686
new ArrayList<>(
@@ -119,7 +119,7 @@ public class ApiClient extends JavaTimeFormatter {
119119
protected boolean debugging = false;
120120
protected ClientConfig clientConfig;
121121
protected int connectionTimeout = 0;
122-
private int readTimeout = 0;
122+
protected int readTimeout = 0;
123123

124124
protected Client httpClient;
125125
protected JSON json;
@@ -287,7 +287,7 @@ public ApiClient setServerVariables(Map<String, String> serverVariables) {
287287
return this;
288288
}
289289

290-
private void updateBasePath() {
290+
protected void updateBasePath() {
291291
if (serverIndex != null) {
292292
setBasePath(servers.get(serverIndex).URL(serverVariables));
293293
}
@@ -463,6 +463,7 @@ public boolean isDebugging() {
463463
*/
464464
public ApiClient setDebugging(boolean debugging) {
465465
this.debugging = debugging;
466+
applyDebugSetting(this.clientConfig);
466467
// Rebuild HTTP Client according to the new "debugging" value.
467468
this.httpClient = buildHttpClient();
468469
return this;
@@ -734,6 +735,41 @@ public String escapeString(String str) {
734735
}
735736
}
736737

738+
/**
739+
* Format the given collection as a path parameter value according to the collection format.
740+
* Each item is escaped individually, so that the delimiter is preserved (e.g. "a,b,c" for csv).
741+
*
742+
* @param collectionFormat Collection format (csv by default)
743+
* @param value Collection value
744+
* @return Escaped path parameter value
745+
*/
746+
public String collectionPathParameterToString(String collectionFormat, Collection<?> value) {
747+
if (value == null || value.isEmpty()) {
748+
return "";
749+
}
750+
751+
// "multi" is not valid for path params, fall back to csv
752+
String delimiter = ",";
753+
if ("ssv".equals(collectionFormat)) {
754+
delimiter = escapeString(" ");
755+
} else if ("tsv".equals(collectionFormat)) {
756+
delimiter = escapeString("\t");
757+
} else if ("pipes".equals(collectionFormat)) {
758+
delimiter = escapeString("|");
759+
}
760+
761+
StringBuilder sb = new StringBuilder();
762+
boolean first = true;
763+
for (Object item : value) {
764+
if (!first) {
765+
sb.append(delimiter);
766+
}
767+
sb.append(escapeString(parameterToString(item)));
768+
first = false;
769+
}
770+
return sb.toString();
771+
}
772+
737773
/**
738774
* Serialize the given Java object into string entity according the given Content-Type (only
739775
* JSON is supported for now).
@@ -814,7 +850,7 @@ public Entity<?> serialize(
814850
* @param key Key of the object
815851
* @param multiPart MultiPart to add the form param to
816852
*/
817-
private void addParamToMultipart(Object value, String key, MultiPart multiPart) {
853+
protected void addParamToMultipart(Object value, String key, MultiPart multiPart) {
818854
if (value instanceof File) {
819855
File file = (File) value;
820856
FormDataContentDisposition contentDisp =
@@ -1021,9 +1057,11 @@ public <T> ApiResponse<T> invokeAPI(
10211057
if (index < 0 || index >= serverConfigurations.size()) {
10221058
throw new ArrayIndexOutOfBoundsException(
10231059
String.format(
1060+
java.util.Locale.ROOT,
10241061
"Invalid index %d when selecting the host settings. Must be less"
10251062
+ " than %d",
1026-
index, serverConfigurations.size()));
1063+
index,
1064+
serverConfigurations.size()));
10271065
}
10281066
targetURL = serverConfigurations.get(index).URL(variables) + path;
10291067
} else {
@@ -1033,6 +1071,22 @@ public <T> ApiResponse<T> invokeAPI(
10331071
// to support (constant) query string in `path`, e.g. "/posts?draft=1"
10341072
WebTarget target = httpClient.target(targetURL);
10351073

1074+
// put all headers in one place
1075+
Map<String, String> allHeaderParams = new HashMap<>(defaultHeaderMap);
1076+
allHeaderParams.putAll(headerParams);
1077+
1078+
if (authNames != null) {
1079+
// update different parameters (e.g. headers) for authentication
1080+
updateParamsForAuth(
1081+
authNames,
1082+
queryParams,
1083+
allHeaderParams,
1084+
cookieParams,
1085+
null,
1086+
method,
1087+
target.getUri());
1088+
}
1089+
10361090
if (queryParams != null) {
10371091
for (Pair queryParam : queryParams) {
10381092
if (queryParam.getValue() != null) {
@@ -1065,22 +1119,6 @@ public <T> ApiResponse<T> invokeAPI(
10651119

10661120
Entity<?> entity = serialize(body, formParams, contentType, isBodyNullable);
10671121

1068-
// put all headers in one place
1069-
Map<String, String> allHeaderParams = new HashMap<>(defaultHeaderMap);
1070-
allHeaderParams.putAll(headerParams);
1071-
1072-
if (authNames != null) {
1073-
// update different parameters (e.g. headers) for authentication
1074-
updateParamsForAuth(
1075-
authNames,
1076-
queryParams,
1077-
allHeaderParams,
1078-
cookieParams,
1079-
null,
1080-
method,
1081-
target.getUri());
1082-
}
1083-
10841122
for (Entry<String, String> entry : allHeaderParams.entrySet()) {
10851123
String value = entry.getValue();
10861124
if (value != null) {
@@ -1142,7 +1180,7 @@ public <T> ApiResponse<T> invokeAPI(
11421180
}
11431181
}
11441182

1145-
private Response sendRequest(
1183+
protected Response sendRequest(
11461184
String method, Invocation.Builder invocationBuilder, Entity<?> entity) {
11471185
Response response;
11481186
if ("POST".equals(method)) {
@@ -1203,8 +1241,10 @@ public <T> ApiResponse<T> invokeAPI(
12031241
* @return Client
12041242
*/
12051243
protected Client buildHttpClient() {
1206-
// recreate the client config to pickup changes
1207-
clientConfig = getDefaultClientConfig();
1244+
// Create ClientConfig if it has not been initialized yet
1245+
if (clientConfig == null) {
1246+
clientConfig = getDefaultClientConfig();
1247+
}
12081248

12091249
ClientBuilder clientBuilder = ClientBuilder.newBuilder();
12101250
clientBuilder = clientBuilder.withConfig(clientConfig);
@@ -1225,6 +1265,11 @@ public ClientConfig getDefaultClientConfig() {
12251265
clientConfig.property(HttpUrlConnectorProvider.SET_METHOD_WORKAROUND, true);
12261266
// turn off compliance validation to be able to send payloads with DELETE calls
12271267
clientConfig.property(ClientProperties.SUPPRESS_HTTP_COMPLIANCE_VALIDATION, true);
1268+
applyDebugSetting(clientConfig);
1269+
return clientConfig;
1270+
}
1271+
1272+
protected void applyDebugSetting(ClientConfig clientConfig) {
12281273
if (debugging) {
12291274
clientConfig.register(
12301275
new LoggingFeature(
@@ -1242,8 +1287,6 @@ public ClientConfig getDefaultClientConfig() {
12421287
java.util.logging.Logger.getLogger("org.glassfish.jersey.client")
12431288
.setLevel(java.util.logging.Level.SEVERE);
12441289
}
1245-
1246-
return clientConfig;
12471290
}
12481291

12491292
/**

‎sdks/java-v1/src/main/java/com/dropbox/sign/ApiException.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
/** API Exception */
2020
@javax.annotation.Generated(
2121
value = "org.openapitools.codegen.languages.JavaClientCodegen",
22-
comments = "Generator version: 7.12.0")
22+
comments = "Generator version: 7.26.0")
2323
public class ApiException extends Exception {
2424
private static final long serialVersionUID = 1L;
2525

‎sdks/java-v1/src/main/java/com/dropbox/sign/Configuration.java‎

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,18 @@
1212

1313
package com.dropbox.sign;
1414

15+
import java.util.Objects;
16+
import java.util.concurrent.atomic.AtomicReference;
17+
import java.util.function.Supplier;
18+
1519
@javax.annotation.Generated(
1620
value = "org.openapitools.codegen.languages.JavaClientCodegen",
17-
comments = "Generator version: 7.12.0")
21+
comments = "Generator version: 7.26.0")
1822
public class Configuration {
1923
public static final String VERSION = "1.11-dev";
2024

21-
private static volatile ApiClient defaultApiClient = new ApiClient();
25+
private static final AtomicReference<ApiClient> defaultApiClient = new AtomicReference<>();
26+
private static volatile Supplier<ApiClient> apiClientFactory = ApiClient::new;
2227

2328
/**
2429
* Get the default API client, which would be used when creating API instances without providing
@@ -27,7 +32,18 @@ public class Configuration {
2732
* @return Default API client
2833
*/
2934
public static ApiClient getDefaultApiClient() {
30-
return defaultApiClient;
35+
ApiClient client = defaultApiClient.get();
36+
if (client == null) {
37+
client =
38+
defaultApiClient.updateAndGet(
39+
val -> {
40+
if (val != null) { // changed by another thread
41+
return val;
42+
}
43+
return apiClientFactory.get();
44+
});
45+
}
46+
return client;
3147
}
3248

3349
/**
@@ -37,6 +53,13 @@ public static ApiClient getDefaultApiClient() {
3753
* @param apiClient API client
3854
*/
3955
public static void setDefaultApiClient(ApiClient apiClient) {
40-
defaultApiClient = apiClient;
56+
defaultApiClient.set(apiClient);
57+
}
58+
59+
/** set the callback used to create new ApiClient objects */
60+
public static void setApiClientFactory(Supplier<ApiClient> factory) {
61+
apiClientFactory = Objects.requireNonNull(factory);
4162
}
63+
64+
public Configuration() {}
4265
}

‎sdks/java-v1/src/main/java/com/dropbox/sign/EventCallbackHelper.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
@javax.annotation.Generated(
2121
value = "org.openapitools.codegen.languages.JavaClientCodegen",
22-
comments = "Generator version: 7.12.0")
22+
comments = "Generator version: 7.26.0")
2323
public class EventCallbackHelper {
2424
public static final String EVENT_TYPE_ACCOUNT_CALLBACK = "account_callback";
2525

0 commit comments

Comments
 (0)