Skip to content

Commit 23cb42f

Browse files
imonkiaalyx-dbjtreminio-dropbox
authored
[WIP] Updating openapi-generator for Java V2 SDK to 7.12.0 (#477)
Co-authored-by: Monica Auriemma <reta@dropbox.com> Co-authored-by: Juan Treminio <juantreminio@dropbox.com>
1 parent 7b79c13 commit 23cb42f

334 files changed

Lines changed: 6336 additions & 3159 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-v2/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ Add this dependency to your project's POM:
5656
<dependency>
5757
<groupId>com.dropbox.sign</groupId>
5858
<artifactId>dropbox-sign</artifactId>
59-
<version>2.4-dev</version>
59+
<version>2.4.1-dev</version>
6060
<scope>compile</scope>
6161
</dependency>
6262
```
@@ -72,7 +72,7 @@ Add this dependency to your project's build file:
7272
}
7373
7474
dependencies {
75-
implementation "com.dropbox.sign:dropbox-sign:2.4-dev"
75+
implementation "com.dropbox.sign:dropbox-sign:2.4.1-dev"
7676
}
7777
```
7878

@@ -86,7 +86,7 @@ mvn clean package
8686

8787
Then manually install the following JARs:
8888

89-
- `target/dropbox-sign-2.4-dev.jar`
89+
- `target/dropbox-sign-2.4.1-dev.jar`
9090
- `target/lib/*.jar`
9191

9292
## Getting Started
@@ -452,7 +452,7 @@ apisupport@hellosign.com
452452
This Java package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
453453

454454
- API version: `3.0.0`
455-
- Package version: `2.4-dev`
455+
- Package version: `2.4.1-dev`
456456
- Build package: `org.openapitools.codegen.languages.JavaClientCodegen`
457457

458458

sdks/java-v2/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.4-dev
1+
2.4.1-dev
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#!/usr/bin/env php
2+
<?php
3+
4+
require_once __DIR__ . '/../vendor/autoload.php';
5+
6+
ini_set('display_errors', 1);
7+
ini_set('display_startup_errors', 1);
8+
error_reporting(E_ALL);
9+
10+
set_error_handler(function ($level, $msg) {
11+
echo "Error: {$msg}";
12+
exit(1);
13+
});
14+
15+
/**
16+
* Between openapi-generator v7.8.0 and v7.12.0 a change was made to the way
17+
* a few generators create constant names from values. The original way was
18+
* actually broken. For example "change-field-visibility" would generate a
19+
* constant name of "TYPE_FIELD_VISIBILITY", dropping the "change" part.
20+
*
21+
* The fix now generates the correct name, "TYPE_CHANGE_FIELD_VISIBILITY".
22+
* However, the fix also gets rid of the previous (incorrect) constant names,
23+
* making the fix a BC break.
24+
*
25+
* This simple script just adds the old constant names back, alongside the new
26+
* ones.
27+
*/
28+
class CopyConstants
29+
{
30+
public function run(): void
31+
{
32+
$file = __DIR__ . '/../src/main/java/com/dropbox/sign/model/SubFormFieldRuleAction.java';
33+
$contents = file_get_contents($file);
34+
35+
$constant_1 = ' CHANGE_FIELD_VISIBILITY(String.valueOf("change-field-visibility")),';
36+
$replace_1 = implode("\n", [
37+
$constant_1,
38+
' FIELD_VISIBILITY(String.valueOf("change-field-visibility")),',
39+
]);
40+
41+
$constant_2 = ' CHANGE_GROUP_VISIBILITY(String.valueOf("change-group-visibility"));';
42+
$replace_2 = implode("\n", [
43+
' CHANGE_GROUP_VISIBILITY(String.valueOf("change-group-visibility")),',
44+
' GROUP_VISIBILITY(String.valueOf("change-group-visibility"));',
45+
]);
46+
47+
$contents = str_replace(
48+
$constant_1,
49+
$replace_1,
50+
$contents,
51+
);
52+
53+
$contents = str_replace(
54+
$constant_2,
55+
$replace_2,
56+
$contents,
57+
);
58+
59+
file_put_contents($file, $contents);
60+
}
61+
}
62+
63+
$copier = new CopyConstants();
64+
$copier->run();

sdks/java-v2/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ apply plugin: 'signing'
2121

2222
group = 'com.dropbox.sign'
2323
archivesBaseName = 'dropbox-sign'
24-
version = '2.4-dev'
24+
version = '2.4.1-dev'
2525
sourceCompatibility = JavaVersion.VERSION_1_8
2626
targetCompatibility = JavaVersion.VERSION_1_8
2727

sdks/java-v2/build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ lazy val root = (project in file(".")).
22
settings(
33
organization := "com.dropbox.sign",
44
name := "dropbox-sign",
5-
version := "2.4-dev",
5+
version := "2.4.1-dev",
66
scalaVersion := "2.11.4",
77
scalacOptions ++= Seq("-feature"),
88
Compile / javacOptions ++= Seq("-Xlint:deprecation"),

sdks/java-v2/docs/SubFormFieldRuleAction.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919

2020
| Name | Value |
2121
---- | -----
22-
| FIELD_VISIBILITY | &quot;change-field-visibility&quot; |
23-
| GROUP_VISIBILITY | &quot;change-group-visibility&quot; |
22+
| CHANGE_FIELD_VISIBILITY | &quot;change-field-visibility&quot; |
23+
| CHANGE_GROUP_VISIBILITY | &quot;change-group-visibility&quot; |
2424

2525

2626

sdks/java-v2/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#target = android
77
GROUP=com.dropbox.sign
88
POM_ARTIFACT_ID=dropbox-sign
9-
VERSION_NAME=2.4-dev
9+
VERSION_NAME=2.4.1-dev
1010

1111
POM_NAME=Dropbox Sign Java SDK
1212
POM_DESCRIPTION=Use the Dropbox Sign Java SDK to connect your Java app to the service of Dropbox Sign in microseconds!

sdks/java-v2/openapi-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ additionalProperties:
1818
groupId: com.dropbox.sign
1919
artifactId: dropbox-sign
2020
artifactName: Dropbox Sign Java SDK
21-
artifactVersion: "2.4-dev"
21+
artifactVersion: "2.4.1-dev"
2222
artifactUrl: https://github.com/hellosign/dropbox-sign-java
2323
artifactDescription: Use the Dropbox Sign Java SDK to connect your Java app to the service of Dropbox Sign in microseconds!
2424
scmConnection: scm:git:git://github.com/hellosign/dropbox-sign-java.git

sdks/java-v2/pom.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<artifactId>dropbox-sign</artifactId>
66
<packaging>jar</packaging>
77
<name>dropbox-sign</name>
8-
<version>2.4-dev</version>
8+
<version>2.4.1-dev</version>
99
<url>https://github.com/hellosign/dropbox-sign-java</url>
1010
<description>Use the Dropbox Sign Java SDK to connect your Java app to the service of Dropbox Sign in microseconds!</description>
1111
<scm>
@@ -334,6 +334,7 @@
334334
<artifactId>jersey-apache-connector</artifactId>
335335
<version>${jersey-version}</version>
336336
</dependency>
337+
337338
<!-- test dependencies -->
338339
<dependency>
339340
<groupId>org.junit.jupiter</groupId>
@@ -355,6 +356,7 @@
355356
<jackson-databind-version>2.17.1</jackson-databind-version>
356357
<jackson-databind-nullable-version>0.2.6</jackson-databind-nullable-version>
357358
<jakarta-annotation-version>2.1.1</jakarta-annotation-version>
359+
<beanvalidation-version>3.0.2</beanvalidation-version>
358360
<junit-version>5.10.0</junit-version>
359361
<spotless.version>2.21.0</spotless.version>
360362
<mockito.version>3.12.4</mockito.version>

sdks/java-v2/run-build

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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.8.0 generate \
21+
openapitools/openapi-generator-cli:v7.12.0 generate \
2222
-i "/local/openapi-sdk.yaml" \
2323
-c "/local/openapi-config.yaml" \
2424
-t "/local/templates" \
@@ -47,6 +47,9 @@ docker run --rm \
4747
-w "${WORKING_DIR}" \
4848
perl bash ./bin/scan_for
4949

50+
printf "Adding old-style constant names ...\n"
51+
bash "${DIR}/bin/php" ./bin/copy-constants.php
52+
5053
# avoid docker messing with permissions
5154
if [[ -z "$GITHUB_ACTIONS" ]]; then
5255
chmod 644 "${DIR}/README.md"

0 commit comments

Comments
 (0)