Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
8 changes: 4 additions & 4 deletions sdks/java-v2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Add this dependency to your project's POM:
<dependency>
<groupId>com.dropbox.sign</groupId>
<artifactId>dropbox-sign</artifactId>
<version>2.4-dev</version>
<version>2.4.1-dev</version>
<scope>compile</scope>
</dependency>
```
Expand All @@ -72,7 +72,7 @@ Add this dependency to your project's build file:
}

dependencies {
implementation "com.dropbox.sign:dropbox-sign:2.4-dev"
implementation "com.dropbox.sign:dropbox-sign:2.4.1-dev"
}
```

Expand All @@ -86,7 +86,7 @@ mvn clean package

Then manually install the following JARs:

- `target/dropbox-sign-2.4-dev.jar`
- `target/dropbox-sign-2.4.1-dev.jar`
- `target/lib/*.jar`

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

- API version: `3.0.0`
- Package version: `2.4-dev`
- Package version: `2.4.1-dev`
- Build package: `org.openapitools.codegen.languages.JavaClientCodegen`


Expand Down
2 changes: 1 addition & 1 deletion sdks/java-v2/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.4-dev
2.4.1-dev
64 changes: 64 additions & 0 deletions sdks/java-v2/bin/copy-constants.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/usr/bin/env php
<?php

require_once __DIR__ . '/../vendor/autoload.php';

ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

set_error_handler(function ($level, $msg) {
echo "Error: {$msg}";
exit(1);
});

/**
* Between openapi-generator v7.8.0 and v7.12.0 a change was made to the way
* a few generators create constant names from values. The original way was
* actually broken. For example "change-field-visibility" would generate a
* constant name of "TYPE_FIELD_VISIBILITY", dropping the "change" part.
*
* The fix now generates the correct name, "TYPE_CHANGE_FIELD_VISIBILITY".
* However, the fix also gets rid of the previous (incorrect) constant names,
* making the fix a BC break.
*
* This simple script just adds the old constant names back, alongside the new
* ones.
*/
class CopyConstants
{
public function run(): void
{
$file = __DIR__ . '/../src/main/java/com/dropbox/sign/model/SubFormFieldRuleAction.java';
$contents = file_get_contents($file);

$constant_1 = ' CHANGE_FIELD_VISIBILITY(String.valueOf("change-field-visibility")),';
$replace_1 = implode("\n", [
$constant_1,
' FIELD_VISIBILITY(String.valueOf("change-field-visibility")),',
]);

$constant_2 = ' CHANGE_GROUP_VISIBILITY(String.valueOf("change-group-visibility"));';
$replace_2 = implode("\n", [
' CHANGE_GROUP_VISIBILITY(String.valueOf("change-group-visibility")),',
' GROUP_VISIBILITY(String.valueOf("change-group-visibility"));',
]);

$contents = str_replace(
$constant_1,
$replace_1,
$contents,
);

$contents = str_replace(
$constant_2,
$replace_2,
$contents,
);

file_put_contents($file, $contents);
}
}

$copier = new CopyConstants();
$copier->run();
2 changes: 1 addition & 1 deletion sdks/java-v2/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ apply plugin: 'signing'

group = 'com.dropbox.sign'
archivesBaseName = 'dropbox-sign'
version = '2.4-dev'
version = '2.4.1-dev'
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8

Expand Down
2 changes: 1 addition & 1 deletion sdks/java-v2/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ lazy val root = (project in file(".")).
settings(
organization := "com.dropbox.sign",
name := "dropbox-sign",
version := "2.4-dev",
version := "2.4.1-dev",
scalaVersion := "2.11.4",
scalacOptions ++= Seq("-feature"),
Compile / javacOptions ++= Seq("-Xlint:deprecation"),
Expand Down
4 changes: 2 additions & 2 deletions sdks/java-v2/docs/SubFormFieldRuleAction.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@

| Name | Value |
---- | -----
| FIELD_VISIBILITY | &quot;change-field-visibility&quot; |
| GROUP_VISIBILITY | &quot;change-group-visibility&quot; |
| CHANGE_FIELD_VISIBILITY | &quot;change-field-visibility&quot; |
| CHANGE_GROUP_VISIBILITY | &quot;change-group-visibility&quot; |



2 changes: 1 addition & 1 deletion sdks/java-v2/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#target = android
GROUP=com.dropbox.sign
POM_ARTIFACT_ID=dropbox-sign
VERSION_NAME=2.4-dev
VERSION_NAME=2.4.1-dev

POM_NAME=Dropbox Sign Java SDK
POM_DESCRIPTION=Use the Dropbox Sign Java SDK to connect your Java app to the service of Dropbox Sign in microseconds!
Expand Down
2 changes: 1 addition & 1 deletion sdks/java-v2/openapi-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ additionalProperties:
groupId: com.dropbox.sign
artifactId: dropbox-sign
artifactName: Dropbox Sign Java SDK
artifactVersion: "2.4-dev"
artifactVersion: "2.4.1-dev"
artifactUrl: https://github.com/hellosign/dropbox-sign-java
artifactDescription: Use the Dropbox Sign Java SDK to connect your Java app to the service of Dropbox Sign in microseconds!
scmConnection: scm:git:git://github.com/hellosign/dropbox-sign-java.git
Expand Down
4 changes: 3 additions & 1 deletion sdks/java-v2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<artifactId>dropbox-sign</artifactId>
<packaging>jar</packaging>
<name>dropbox-sign</name>
<version>2.4-dev</version>
<version>2.4.1-dev</version>
<url>https://github.com/hellosign/dropbox-sign-java</url>
<description>Use the Dropbox Sign Java SDK to connect your Java app to the service of Dropbox Sign in microseconds!</description>
<scm>
Expand Down Expand Up @@ -334,6 +334,7 @@
<artifactId>jersey-apache-connector</artifactId>
<version>${jersey-version}</version>
</dependency>

<!-- test dependencies -->
<dependency>
<groupId>org.junit.jupiter</groupId>
Expand All @@ -355,6 +356,7 @@
<jackson-databind-version>2.17.1</jackson-databind-version>
<jackson-databind-nullable-version>0.2.6</jackson-databind-nullable-version>
<jakarta-annotation-version>2.1.1</jakarta-annotation-version>
<beanvalidation-version>3.0.2</beanvalidation-version>
<junit-version>5.10.0</junit-version>
<spotless.version>2.21.0</spotless.version>
<mockito.version>3.12.4</mockito.version>
Expand Down
5 changes: 4 additions & 1 deletion sdks/java-v2/run-build
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ rm -f "${DIR}/src/main/java/com/dropbox/sign/model/"*.java

docker run --rm \
-v "${DIR}/:/local" \
openapitools/openapi-generator-cli:v7.8.0 generate \
openapitools/openapi-generator-cli:v7.12.0 generate \
-i "/local/openapi-sdk.yaml" \
-c "/local/openapi-config.yaml" \
-t "/local/templates" \
Expand Down Expand Up @@ -47,6 +47,9 @@ docker run --rm \
-w "${WORKING_DIR}" \
perl bash ./bin/scan_for

printf "Adding old-style constant names ...\n"
bash "${DIR}/bin/php" ./bin/copy-constants.php

# avoid docker messing with permissions
if [[ -z "$GITHUB_ACTIONS" ]]; then
chmod 644 "${DIR}/README.md"
Expand Down
60 changes: 40 additions & 20 deletions sdks/java-v2/src/main/java/com/dropbox/sign/ApiClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
/**
* <p>ApiClient class.</p>
*/
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0")
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.12.0")
public class ApiClient extends JavaTimeFormatter {
private static final Pattern JSON_MIME_PATTERN = Pattern.compile("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");

Expand Down Expand Up @@ -159,7 +159,7 @@ public ApiClient(Map<String, Authentication> authMap) {
this.dateFormat = new RFC3339DateFormat();

// Set default User-Agent.
setUserAgent("OpenAPI-Generator/2.4-dev/java");
setUserAgent("OpenAPI-Generator/2.4.1-dev/java");

// Setup authentications (key: authentication name, value: authentication).
authentications = new HashMap<>();
Expand Down Expand Up @@ -807,24 +807,10 @@ public Entity<?> serialize(Object obj, Map<String, Object> formParams, String co
if (contentType.startsWith("multipart/form-data")) {
MultiPart multiPart = new MultiPart();
for (Entry<String, Object> param: formParams.entrySet()) {
if (param.getValue() instanceof File) {
File file = (File) param.getValue();
FormDataContentDisposition contentDisp = FormDataContentDisposition.name(param.getKey())
.fileName(file.getName()).size(file.length()).build();

// Attempt to probe the content type for the file so that the form part is more correctly
// and precisely identified, but fall back to application/octet-stream if that fails.
MediaType type;
try {
type = MediaType.valueOf(Files.probeContentType(file.toPath()));
} catch (IOException | IllegalArgumentException e) {
type = MediaType.APPLICATION_OCTET_STREAM_TYPE;
}

multiPart.bodyPart(new FormDataBodyPart(contentDisp, file, type));
if (param.getValue() instanceof Iterable<?>) {
((Iterable<?>)param.getValue()).forEach(v -> addParamToMultipart(v, param.getKey(), multiPart));
} else {
FormDataContentDisposition contentDisp = FormDataContentDisposition.name(param.getKey()).build();
multiPart.bodyPart(new FormDataBodyPart(contentDisp, parameterToString(param.getValue())));
addParamToMultipart(param.getValue(), param.getKey(), multiPart);
}
}
entity = Entity.entity(multiPart, MediaType.MULTIPART_FORM_DATA_TYPE);
Expand Down Expand Up @@ -853,6 +839,36 @@ public Entity<?> serialize(Object obj, Map<String, Object> formParams, String co
return entity;
}

/**
* Adds the object with the provided key to the MultiPart.
* Based on the object type sets Content-Disposition and Content-Type.
*
* @param obj Object
* @param key Key of the object
* @param multiPart MultiPart to add the form param to
*/
private void addParamToMultipart(Object value, String key, MultiPart multiPart) {
if (value instanceof File) {
File file = (File) value;
FormDataContentDisposition contentDisp = FormDataContentDisposition.name(key)
.fileName(file.getName()).size(file.length()).build();

// Attempt to probe the content type for the file so that the form part is more correctly
// and precisely identified, but fall back to application/octet-stream if that fails.
MediaType type;
try {
type = MediaType.valueOf(Files.probeContentType(file.toPath()));
} catch (IOException | IllegalArgumentException e) {
type = MediaType.APPLICATION_OCTET_STREAM_TYPE;
}

multiPart.bodyPart(new FormDataBodyPart(contentDisp, file, type));
} else {
FormDataContentDisposition contentDisp = FormDataContentDisposition.name(key).build();
multiPart.bodyPart(new FormDataBodyPart(contentDisp, parameterToString(value)));
}
}

/**
* Serialize the given Java object into string according the given
* Content-Type (only JSON, HTTP form is supported for now).
Expand Down Expand Up @@ -1143,7 +1159,11 @@ private Response sendRequest(String method, Invocation.Builder invocationBuilder
} else if ("PUT".equals(method)) {
response = invocationBuilder.put(entity);
} else if ("DELETE".equals(method)) {
response = invocationBuilder.method("DELETE", entity);
if ("".equals(entity.getEntity())) {
response = invocationBuilder.method("DELETE");
} else {
response = invocationBuilder.method("DELETE", entity);
}
} else if ("PATCH".equals(method)) {
response = invocationBuilder.method("PATCH", entity);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
/**
* API Exception
*/
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0")
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.12.0")
public class ApiException extends Exception {
private static final long serialVersionUID = 1L;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@

package com.dropbox.sign;

@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0")
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.12.0")
public class Configuration {
public static final String VERSION = "2.4-dev";
public static final String VERSION = "2.4.1-dev";

private static ApiClient defaultApiClient = new ApiClient();
private static volatile ApiClient defaultApiClient = new ApiClient();

/**
* Get the default API client, which would be used when creating API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import org.apache.commons.codec.digest.HmacAlgorithms;
import org.apache.commons.codec.digest.HmacUtils;

@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0")
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.12.0")
public class EventCallbackHelper {
public static final String EVENT_TYPE_ACCOUNT_CALLBACK = "account_callback";

Expand Down
3 changes: 1 addition & 2 deletions sdks/java-v2/src/main/java/com/dropbox/sign/JSON.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.json.JsonMapper;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import com.dropbox.sign.model.*;

import java.text.DateFormat;
import java.util.HashMap;
Expand All @@ -27,7 +26,7 @@
import jakarta.ws.rs.core.GenericType;
import jakarta.ws.rs.ext.ContextResolver;

@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0")
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.12.0")
public class JSON implements ContextResolver<ObjectMapper> {
private ObjectMapper mapper;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* Class that add parsing/formatting support for Java 8+ {@code OffsetDateTime} class.
* It's generated for java clients when {@code AbstractJavaCodegen#dateLibrary} specified as {@code java8}.
*/
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0")
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.12.0")
public class JavaTimeFormatter {

private DateTimeFormatter offsetDateTimeFormatter = DateTimeFormatter.ISO_OFFSET_DATE_TIME;
Expand Down
2 changes: 1 addition & 1 deletion sdks/java-v2/src/main/java/com/dropbox/sign/Pair.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

package com.dropbox.sign;

@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0")
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.12.0")
public class Pair {
private String name = "";
private String value = "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import java.util.GregorianCalendar;
import java.util.TimeZone;

@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0")
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.12.0")
public class RFC3339DateFormat extends DateFormat {
private static final long serialVersionUID = 1L;
private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
/**
* Representing a Server configuration.
*/
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0")
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.12.0")
public class ServerConfiguration {
public String URL;
public String description;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
/**
* Representing a Server Variable for server URL template substitution.
*/
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0")
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.12.0")
public class ServerVariable {
public String description;
public String defaultValue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import java.util.Collection;
import java.util.Iterator;

@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0")
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.12.0")
public class StringUtil {
/**
* Check if the given array contains the given value (with case-insensitive comparison).
Expand Down
Loading