Merge remote-tracking branch 'origin' into 7.0.x

This commit is contained in:
William Cheng
2023-03-03 21:52:50 +08:00
10595 changed files with 418520 additions and 73194 deletions

View File

@@ -101,7 +101,7 @@ ext {
swagger_annotations_version = "1.6.5"
jackson_version = "2.13.4"
jackson_databind_version = "2.13.4.2"
jackson_databind_nullable_version = "0.2.4"
jackson_databind_nullable_version = "0.2.6"
jakarta_annotation_version = "1.3.5"
jersey_version = "2.35"
junit_version = "5.8.2"

View File

@@ -20,7 +20,7 @@ lazy val root = (project in file(".")).
"com.fasterxml.jackson.core" % "jackson-annotations" % "2.13.2" % "compile",
"com.fasterxml.jackson.core" % "jackson-databind" % "2.13.4.1" % "compile",
"com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.13.2" % "compile",
"org.openapitools" % "jackson-databind-nullable" % "0.2.4" % "compile",
"org.openapitools" % "jackson-databind-nullable" % "0.2.6" % "compile",
"jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile",
"org.junit.jupiter" % "junit-jupiter-api" % "5.8.2" % "test"
)

View File

@@ -251,11 +251,6 @@
</profiles>
<dependencies>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>${swagger-annotations-version}</version>
</dependency>
<!-- @Nullable annotation -->
<dependency>
@@ -333,11 +328,11 @@
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<swagger-annotations-version>1.6.5</swagger-annotations-version>
<swagger-annotations-version>1.6.6</swagger-annotations-version>
<jersey-version>2.35</jersey-version>
<jackson-version>2.13.4</jackson-version>
<jackson-databind-version>2.13.4.2</jackson-databind-version>
<jackson-databind-nullable-version>0.2.4</jackson-databind-nullable-version>
<jackson-databind-nullable-version>0.2.6</jackson-databind-nullable-version>
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
<junit-version>5.8.2</junit-version>
<spotless.version>2.21.0</spotless.version>

View File

@@ -384,9 +384,10 @@ public class ApiClient extends JavaTimeFormatter {
if (auth instanceof ApiKeyAuth) {
String name = authEntry.getKey();
// respect x-auth-id-alias property
name = authenticationLookup.containsKey(name) ? authenticationLookup.get(name) : name;
if (secrets.containsKey(name)) {
((ApiKeyAuth) auth).setApiKey(secrets.get(name));
name = authenticationLookup.getOrDefault(name, name);
String secret = secrets.get(name);
if (secret != null) {
((ApiKeyAuth) auth).setApiKey(secret);
}
}
}
@@ -902,11 +903,6 @@ public class ApiClient extends JavaTimeFormatter {
return file;
}
String contentType = null;
List<Object> contentTypes = response.getHeaders().get("Content-Type");
if (contentTypes != null && !contentTypes.isEmpty())
contentType = String.valueOf(contentTypes.get(0));
// read the entity stream multiple times
response.bufferEntity();
@@ -1008,14 +1004,11 @@ public class ApiClient extends JavaTimeFormatter {
boolean isBodyNullable)
throws ApiException {
// Not using `.target(targetURL).path(path)` below,
// to support (constant) query string in `path`, e.g. "/posts?draft=1"
String targetURL;
if (serverIndex != null && operationServers.containsKey(operation)) {
Integer index = operationServerIndex.containsKey(operation) ? operationServerIndex.get(operation) : serverIndex;
Map<String, String> variables = operationServerVariables.containsKey(operation) ?
operationServerVariables.get(operation) : serverVariables;
List<ServerConfiguration> serverConfigurations = operationServers.get(operation);
List<ServerConfiguration> serverConfigurations;
if (serverIndex != null && (serverConfigurations = operationServers.get(operation)) != null) {
int index = operationServerIndex.getOrDefault(operation, serverIndex).intValue();
Map<String, String> variables = operationServerVariables.getOrDefault(operation, serverVariables);
if (index < 0 || index >= serverConfigurations.size()) {
throw new ArrayIndexOutOfBoundsException(
String.format(
@@ -1026,6 +1019,8 @@ public class ApiClient extends JavaTimeFormatter {
} else {
targetURL = this.basePath + path;
}
// Not using `.target(targetURL).path(path)` below,
// to support (constant) query string in `path`, e.g. "/posts?draft=1"
WebTarget target = httpClient.target(targetURL);
if (queryParams != null) {
@@ -1036,11 +1031,10 @@ public class ApiClient extends JavaTimeFormatter {
}
}
Invocation.Builder invocationBuilder;
Invocation.Builder invocationBuilder = target.request();
if (accept != null) {
invocationBuilder = target.request().accept(accept);
} else {
invocationBuilder = target.request();
invocationBuilder = invocationBuilder.accept(accept);
}
for (Entry<String, String> entry : cookieParams.entrySet()) {
@@ -1085,10 +1079,11 @@ public class ApiClient extends JavaTimeFormatter {
try {
response = sendRequest(method, invocationBuilder, entity);
int statusCode = response.getStatusInfo().getStatusCode();
final int statusCode = response.getStatusInfo().getStatusCode();
Map<String, List<String>> responseHeaders = buildResponseHeaders(response);
if (response.getStatusInfo() == Status.NO_CONTENT) {
if (statusCode == Status.NO_CONTENT.getStatusCode()) {
return new ApiResponse<T>(statusCode, responseHeaders);
} else if (response.getStatusInfo().getFamily() == Status.Family.SUCCESSFUL) {
if (returnType == null) {

View File

@@ -19,18 +19,18 @@ public class JSON implements ContextResolver<ObjectMapper> {
private ObjectMapper mapper;
public JSON() {
mapper = new ObjectMapper();
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
JsonMapper.builder().configure(MapperFeature.ALLOW_COERCION_OF_SCALARS, false);
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true);
mapper.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, true);
mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
mapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING);
mapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING);
mapper.setDateFormat(new RFC3339DateFormat());
mapper.registerModule(new JavaTimeModule());
JsonNullableModule jnm = new JsonNullableModule();
mapper.registerModule(jnm);
mapper = JsonMapper.builder()
.serializationInclusion(JsonInclude.Include.NON_NULL)
.configure(MapperFeature.ALLOW_COERCION_OF_SCALARS, false)
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true)
.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, true)
.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING)
.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING)
.defaultDateFormat(new RFC3339DateFormat())
.addModule(new JavaTimeModule())
.addModule(new JsonNullableModule())
.build();
}
/**