Merge remote-tracking branch 'origin/5.3.x' into 6.0.x

This commit is contained in:
William Cheng
2021-07-12 17:11:35 +08:00
3874 changed files with 120282 additions and 21640 deletions

View File

@@ -1 +1,5 @@
6.0.0-SNAPSHOT
<<<<<<< HEAD
6.0.0-SNAPSHOT
=======
5.3.0-SNAPSHOT
>>>>>>> origin/5.3.x

View File

@@ -22,6 +22,17 @@ apply plugin: 'maven'
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
// Some text from the schema is copy pasted into the source files as UTF-8
// but the default still seems to be to use platform encoding
tasks.withType(JavaCompile) {
configure(options) {
options.encoding = 'UTF-8'
}
}
javadoc {
options.encoding = 'UTF-8'
}
install {
repositories.mavenInstaller {
pom.artifactId = 'petstore-native'
@@ -53,7 +64,6 @@ ext {
swagger_annotations_version = "1.5.22"
jackson_version = "2.10.4"
junit_version = "4.13.1"
ws_rs_version = "2.1.1"
}
dependencies {
@@ -65,6 +75,5 @@ dependencies {
implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version"
implementation "org.openapitools:jackson-databind-nullable:0.2.1"
implementation 'javax.annotation:javax.annotation-api:1.3.2'
implementation "javax.ws.rs:javax.ws.rs-api:$ws_rs_version"
testImplementation "junit:junit:$junit_version"
}

View File

@@ -200,13 +200,6 @@
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.ws.rs/javax.ws.rs-api -->
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<version>${javax-ws-rs-api-version}</version>
</dependency>
<!-- test dependencies -->
<dependency>
<groupId>junit</groupId>
@@ -224,7 +217,6 @@
<jackson-version>2.10.4</jackson-version>
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
<javax-annotation-version>1.3.2</javax-annotation-version>
<javax-ws-rs-api-version>2.1.1</javax-ws-rs-api-version>
<junit-version>4.13.1</junit-version>
</properties>
</project>

View File

@@ -11,11 +11,9 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import javax.ws.rs.core.GenericType;
import javax.ws.rs.ext.ContextResolver;
@javax.annotation.processing.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class JSON implements ContextResolver<ObjectMapper> {
public class JSON {
private ObjectMapper mapper;
public JSON() {
@@ -41,11 +39,6 @@ public class JSON implements ContextResolver<ObjectMapper> {
mapper.setDateFormat(dateFormat);
}
@Override
public ObjectMapper getContext(Class<?> type) {
return mapper;
}
/**
* Get the object mapper
*
@@ -178,10 +171,10 @@ public class JSON implements ContextResolver<ObjectMapper> {
visitedClasses.add(modelClass);
// Traverse the oneOf/anyOf composed schemas.
Map<String, GenericType> descendants = modelDescendants.get(modelClass);
Map<String, Class<?>> descendants = modelDescendants.get(modelClass);
if (descendants != null) {
for (GenericType childType : descendants.values()) {
if (isInstanceOf(childType.getRawType(), inst, visitedClasses)) {
for (Class<?> childType : descendants.values()) {
if (isInstanceOf(childType, inst, visitedClasses)) {
return true;
}
}
@@ -192,12 +185,12 @@ public class JSON implements ContextResolver<ObjectMapper> {
/**
* A map of discriminators for all model classes.
*/
private static Map<Class<?>, ClassDiscriminatorMapping> modelDiscriminators = new HashMap<Class<?>, ClassDiscriminatorMapping>();
private static Map<Class<?>, ClassDiscriminatorMapping> modelDiscriminators = new HashMap<>();
/**
* A map of oneOf/anyOf descendants for each model class.
*/
private static Map<Class<?>, Map<String, GenericType>> modelDescendants = new HashMap<Class<?>, Map<String, GenericType>>();
private static Map<Class<?>, Map<String, Class<?>>> modelDescendants = new HashMap<>();
/**
* Register a model class discriminator.
@@ -217,7 +210,7 @@ public class JSON implements ContextResolver<ObjectMapper> {
* @param modelClass the model class
* @param descendants a map of oneOf/anyOf descendants.
*/
public static void registerDescendants(Class<?> modelClass, Map<String, GenericType> descendants) {
public static void registerDescendants(Class<?> modelClass, Map<String, Class<?>> descendants) {
modelDescendants.put(modelClass, descendants);
}

View File

@@ -60,19 +60,16 @@ public class AnotherFakeApi {
memberVarResponseInterceptor = apiClient.getResponseInterceptor();
}
private ApiException getApiException(String operationId, HttpResponse<String>localVarResponse) {
return new ApiException(localVarResponse.statusCode(),
operationId + " call received non-success response",
localVarResponse.headers(),
localVarResponse.body());
private ApiException getApiException(String operationId, HttpResponse<String> response) {
String message = formatExceptionMessage(operationId, response.statusCode(), response.body());
return new ApiException(response.statusCode(), message, response.headers(), response.body());
}
protected ApiException createApiException(HttpResponse<InputStream> response, String msgPrefix) throws IOException {
String body = response.body() == null ? null : new String(response.body().readAllBytes());
if (body != null) {
msgPrefix += ": " + body;
private String formatExceptionMessage(String operationId, int statusCode, String body) {
if (body == null || body.isEmpty()) {
body = "[no body]";
}
return new ApiException(response.statusCode(), msgPrefix, response.headers(), body);
return operationId + " call failed with: " + statusCode + " - " + body;
}
/**

View File

@@ -68,19 +68,16 @@ public class FakeApi {
memberVarResponseInterceptor = apiClient.getResponseInterceptor();
}
private ApiException getApiException(String operationId, HttpResponse<String>localVarResponse) {
return new ApiException(localVarResponse.statusCode(),
operationId + " call received non-success response",
localVarResponse.headers(),
localVarResponse.body());
private ApiException getApiException(String operationId, HttpResponse<String> response) {
String message = formatExceptionMessage(operationId, response.statusCode(), response.body());
return new ApiException(response.statusCode(), message, response.headers(), response.body());
}
protected ApiException createApiException(HttpResponse<InputStream> response, String msgPrefix) throws IOException {
String body = response.body() == null ? null : new String(response.body().readAllBytes());
if (body != null) {
msgPrefix += ": " + body;
private String formatExceptionMessage(String operationId, int statusCode, String body) {
if (body == null || body.isEmpty()) {
body = "[no body]";
}
return new ApiException(response.statusCode(), msgPrefix, response.headers(), body);
return operationId + " call failed with: " + statusCode + " - " + body;
}
/**

View File

@@ -60,19 +60,16 @@ public class FakeClassnameTags123Api {
memberVarResponseInterceptor = apiClient.getResponseInterceptor();
}
private ApiException getApiException(String operationId, HttpResponse<String>localVarResponse) {
return new ApiException(localVarResponse.statusCode(),
operationId + " call received non-success response",
localVarResponse.headers(),
localVarResponse.body());
private ApiException getApiException(String operationId, HttpResponse<String> response) {
String message = formatExceptionMessage(operationId, response.statusCode(), response.body());
return new ApiException(response.statusCode(), message, response.headers(), response.body());
}
protected ApiException createApiException(HttpResponse<InputStream> response, String msgPrefix) throws IOException {
String body = response.body() == null ? null : new String(response.body().readAllBytes());
if (body != null) {
msgPrefix += ": " + body;
private String formatExceptionMessage(String operationId, int statusCode, String body) {
if (body == null || body.isEmpty()) {
body = "[no body]";
}
return new ApiException(response.statusCode(), msgPrefix, response.headers(), body);
return operationId + " call failed with: " + statusCode + " - " + body;
}
/**

View File

@@ -63,19 +63,16 @@ public class PetApi {
memberVarResponseInterceptor = apiClient.getResponseInterceptor();
}
private ApiException getApiException(String operationId, HttpResponse<String>localVarResponse) {
return new ApiException(localVarResponse.statusCode(),
operationId + " call received non-success response",
localVarResponse.headers(),
localVarResponse.body());
private ApiException getApiException(String operationId, HttpResponse<String> response) {
String message = formatExceptionMessage(operationId, response.statusCode(), response.body());
return new ApiException(response.statusCode(), message, response.headers(), response.body());
}
protected ApiException createApiException(HttpResponse<InputStream> response, String msgPrefix) throws IOException {
String body = response.body() == null ? null : new String(response.body().readAllBytes());
if (body != null) {
msgPrefix += ": " + body;
private String formatExceptionMessage(String operationId, int statusCode, String body) {
if (body == null || body.isEmpty()) {
body = "[no body]";
}
return new ApiException(response.statusCode(), msgPrefix, response.headers(), body);
return operationId + " call failed with: " + statusCode + " - " + body;
}
/**

View File

@@ -60,19 +60,16 @@ public class StoreApi {
memberVarResponseInterceptor = apiClient.getResponseInterceptor();
}
private ApiException getApiException(String operationId, HttpResponse<String>localVarResponse) {
return new ApiException(localVarResponse.statusCode(),
operationId + " call received non-success response",
localVarResponse.headers(),
localVarResponse.body());
private ApiException getApiException(String operationId, HttpResponse<String> response) {
String message = formatExceptionMessage(operationId, response.statusCode(), response.body());
return new ApiException(response.statusCode(), message, response.headers(), response.body());
}
protected ApiException createApiException(HttpResponse<InputStream> response, String msgPrefix) throws IOException {
String body = response.body() == null ? null : new String(response.body().readAllBytes());
if (body != null) {
msgPrefix += ": " + body;
private String formatExceptionMessage(String operationId, int statusCode, String body) {
if (body == null || body.isEmpty()) {
body = "[no body]";
}
return new ApiException(response.statusCode(), msgPrefix, response.headers(), body);
return operationId + " call failed with: " + statusCode + " - " + body;
}
/**

View File

@@ -60,19 +60,16 @@ public class UserApi {
memberVarResponseInterceptor = apiClient.getResponseInterceptor();
}
private ApiException getApiException(String operationId, HttpResponse<String>localVarResponse) {
return new ApiException(localVarResponse.statusCode(),
operationId + " call received non-success response",
localVarResponse.headers(),
localVarResponse.body());
private ApiException getApiException(String operationId, HttpResponse<String> response) {
String message = formatExceptionMessage(operationId, response.statusCode(), response.body());
return new ApiException(response.statusCode(), message, response.headers(), response.body());
}
protected ApiException createApiException(HttpResponse<InputStream> response, String msgPrefix) throws IOException {
String body = response.body() == null ? null : new String(response.body().readAllBytes());
if (body != null) {
msgPrefix += ": " + body;
private String formatExceptionMessage(String operationId, int statusCode, String body) {
if (body == null || body.isEmpty()) {
body = "[no body]";
}
return new ApiException(response.statusCode(), msgPrefix, response.headers(), body);
return operationId + " call failed with: " + statusCode + " - " + body;
}
/**

View File

@@ -17,7 +17,6 @@ import org.openapitools.client.ApiException;
import java.util.Objects;
import java.lang.reflect.Type;
import java.util.Map;
import javax.ws.rs.core.GenericType;
import com.fasterxml.jackson.annotation.JsonValue;
@@ -46,7 +45,7 @@ public abstract class AbstractOpenApiSchema {
*
* @return an instance of the actual schema/object
*/
public abstract Map<String, GenericType> getSchemas();
public abstract Map<String, Class<?>> getSchemas();
/**
* Get the actual instance