mirror of
https://github.com/jlengrand/openapi-generator.git
synced 2026-05-11 00:21:18 +00:00
Merge remote-tracking branch 'origin/5.3.x' into 6.0.x
This commit is contained in:
@@ -1 +1,5 @@
|
||||
6.0.0-SNAPSHOT
|
||||
<<<<<<< HEAD
|
||||
6.0.0-SNAPSHOT
|
||||
=======
|
||||
5.3.0-SNAPSHOT
|
||||
>>>>>>> origin/5.3.x
|
||||
|
||||
@@ -1 +1,5 @@
|
||||
6.0.0-SNAPSHOT
|
||||
<<<<<<< HEAD
|
||||
6.0.0-SNAPSHOT
|
||||
=======
|
||||
5.3.0-SNAPSHOT
|
||||
>>>>>>> origin/5.3.x
|
||||
|
||||
@@ -1 +1,5 @@
|
||||
6.0.0-SNAPSHOT
|
||||
<<<<<<< HEAD
|
||||
6.0.0-SNAPSHOT
|
||||
=======
|
||||
5.3.0-SNAPSHOT
|
||||
>>>>>>> origin/5.3.x
|
||||
|
||||
@@ -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-openapi3-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"
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -58,12 +58,17 @@ public class AnotherFakeApi {
|
||||
memberVarResponseInterceptor = apiClient.getResponseInterceptor();
|
||||
}
|
||||
|
||||
protected ApiException createApiException(HttpResponse<InputStream> response, String msgPrefix) throws IOException {
|
||||
protected ApiException getApiException(String operationId, HttpResponse<InputStream> response) throws IOException {
|
||||
String body = response.body() == null ? null : new String(response.body().readAllBytes());
|
||||
if (body != null) {
|
||||
msgPrefix += ": " + body;
|
||||
String message = formatExceptionMessage(operationId, response.statusCode(), body);
|
||||
return new ApiException(response.statusCode(), message, response.headers(), 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;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -95,7 +100,7 @@ public class AnotherFakeApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw createApiException(localVarResponse, "call123testSpecialTags call received non-success response");
|
||||
throw getApiException("call123testSpecialTags", localVarResponse);
|
||||
}
|
||||
return new ApiResponse<Client>(
|
||||
localVarResponse.statusCode(),
|
||||
|
||||
@@ -58,12 +58,17 @@ public class DefaultApi {
|
||||
memberVarResponseInterceptor = apiClient.getResponseInterceptor();
|
||||
}
|
||||
|
||||
protected ApiException createApiException(HttpResponse<InputStream> response, String msgPrefix) throws IOException {
|
||||
protected ApiException getApiException(String operationId, HttpResponse<InputStream> response) throws IOException {
|
||||
String body = response.body() == null ? null : new String(response.body().readAllBytes());
|
||||
if (body != null) {
|
||||
msgPrefix += ": " + body;
|
||||
String message = formatExceptionMessage(operationId, response.statusCode(), body);
|
||||
return new ApiException(response.statusCode(), message, response.headers(), 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;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -93,7 +98,7 @@ public class DefaultApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw createApiException(localVarResponse, "fooGet call received non-success response");
|
||||
throw getApiException("fooGet", localVarResponse);
|
||||
}
|
||||
return new ApiResponse<InlineResponseDefault>(
|
||||
localVarResponse.statusCode(),
|
||||
|
||||
@@ -67,12 +67,17 @@ public class FakeApi {
|
||||
memberVarResponseInterceptor = apiClient.getResponseInterceptor();
|
||||
}
|
||||
|
||||
protected ApiException createApiException(HttpResponse<InputStream> response, String msgPrefix) throws IOException {
|
||||
protected ApiException getApiException(String operationId, HttpResponse<InputStream> response) throws IOException {
|
||||
String body = response.body() == null ? null : new String(response.body().readAllBytes());
|
||||
if (body != null) {
|
||||
msgPrefix += ": " + body;
|
||||
String message = formatExceptionMessage(operationId, response.statusCode(), body);
|
||||
return new ApiException(response.statusCode(), message, response.headers(), 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;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -102,7 +107,7 @@ public class FakeApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw createApiException(localVarResponse, "fakeHealthGet call received non-success response");
|
||||
throw getApiException("fakeHealthGet", localVarResponse);
|
||||
}
|
||||
return new ApiResponse<HealthCheckResult>(
|
||||
localVarResponse.statusCode(),
|
||||
@@ -166,7 +171,7 @@ public class FakeApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw createApiException(localVarResponse, "fakeOuterBooleanSerialize call received non-success response");
|
||||
throw getApiException("fakeOuterBooleanSerialize", localVarResponse);
|
||||
}
|
||||
return new ApiResponse<Boolean>(
|
||||
localVarResponse.statusCode(),
|
||||
@@ -236,7 +241,7 @@ public class FakeApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw createApiException(localVarResponse, "fakeOuterCompositeSerialize call received non-success response");
|
||||
throw getApiException("fakeOuterCompositeSerialize", localVarResponse);
|
||||
}
|
||||
return new ApiResponse<OuterComposite>(
|
||||
localVarResponse.statusCode(),
|
||||
@@ -306,7 +311,7 @@ public class FakeApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw createApiException(localVarResponse, "fakeOuterNumberSerialize call received non-success response");
|
||||
throw getApiException("fakeOuterNumberSerialize", localVarResponse);
|
||||
}
|
||||
return new ApiResponse<BigDecimal>(
|
||||
localVarResponse.statusCode(),
|
||||
@@ -376,7 +381,7 @@ public class FakeApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw createApiException(localVarResponse, "fakeOuterStringSerialize call received non-success response");
|
||||
throw getApiException("fakeOuterStringSerialize", localVarResponse);
|
||||
}
|
||||
return new ApiResponse<String>(
|
||||
localVarResponse.statusCode(),
|
||||
@@ -444,7 +449,7 @@ public class FakeApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw createApiException(localVarResponse, "getArrayOfEnums call received non-success response");
|
||||
throw getApiException("getArrayOfEnums", localVarResponse);
|
||||
}
|
||||
return new ApiResponse<List<OuterEnum>>(
|
||||
localVarResponse.statusCode(),
|
||||
@@ -506,7 +511,7 @@ public class FakeApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw createApiException(localVarResponse, "testBodyWithFileSchema call received non-success response");
|
||||
throw getApiException("testBodyWithFileSchema", localVarResponse);
|
||||
}
|
||||
return new ApiResponse<Void>(
|
||||
localVarResponse.statusCode(),
|
||||
@@ -580,7 +585,7 @@ public class FakeApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw createApiException(localVarResponse, "testBodyWithQueryParams call received non-success response");
|
||||
throw getApiException("testBodyWithQueryParams", localVarResponse);
|
||||
}
|
||||
return new ApiResponse<Void>(
|
||||
localVarResponse.statusCode(),
|
||||
@@ -667,7 +672,7 @@ public class FakeApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw createApiException(localVarResponse, "testClientModel call received non-success response");
|
||||
throw getApiException("testClientModel", localVarResponse);
|
||||
}
|
||||
return new ApiResponse<Client>(
|
||||
localVarResponse.statusCode(),
|
||||
@@ -765,7 +770,7 @@ public class FakeApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw createApiException(localVarResponse, "testEndpointParameters call received non-success response");
|
||||
throw getApiException("testEndpointParameters", localVarResponse);
|
||||
}
|
||||
return new ApiResponse<Void>(
|
||||
localVarResponse.statusCode(),
|
||||
@@ -857,7 +862,7 @@ public class FakeApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw createApiException(localVarResponse, "testEnumParameters call received non-success response");
|
||||
throw getApiException("testEnumParameters", localVarResponse);
|
||||
}
|
||||
return new ApiResponse<Void>(
|
||||
localVarResponse.statusCode(),
|
||||
@@ -980,7 +985,7 @@ public class FakeApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw createApiException(localVarResponse, "testGroupParameters call received non-success response");
|
||||
throw getApiException("testGroupParameters", localVarResponse);
|
||||
}
|
||||
return new ApiResponse<Void>(
|
||||
localVarResponse.statusCode(),
|
||||
@@ -1149,7 +1154,7 @@ public class FakeApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw createApiException(localVarResponse, "testInlineAdditionalProperties call received non-success response");
|
||||
throw getApiException("testInlineAdditionalProperties", localVarResponse);
|
||||
}
|
||||
return new ApiResponse<Void>(
|
||||
localVarResponse.statusCode(),
|
||||
@@ -1223,7 +1228,7 @@ public class FakeApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw createApiException(localVarResponse, "testJsonFormData call received non-success response");
|
||||
throw getApiException("testJsonFormData", localVarResponse);
|
||||
}
|
||||
return new ApiResponse<Void>(
|
||||
localVarResponse.statusCode(),
|
||||
@@ -1301,7 +1306,7 @@ public class FakeApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw createApiException(localVarResponse, "testQueryParameterCollectionFormat call received non-success response");
|
||||
throw getApiException("testQueryParameterCollectionFormat", localVarResponse);
|
||||
}
|
||||
return new ApiResponse<Void>(
|
||||
localVarResponse.statusCode(),
|
||||
|
||||
@@ -58,12 +58,17 @@ public class FakeClassnameTags123Api {
|
||||
memberVarResponseInterceptor = apiClient.getResponseInterceptor();
|
||||
}
|
||||
|
||||
protected ApiException createApiException(HttpResponse<InputStream> response, String msgPrefix) throws IOException {
|
||||
protected ApiException getApiException(String operationId, HttpResponse<InputStream> response) throws IOException {
|
||||
String body = response.body() == null ? null : new String(response.body().readAllBytes());
|
||||
if (body != null) {
|
||||
msgPrefix += ": " + body;
|
||||
String message = formatExceptionMessage(operationId, response.statusCode(), body);
|
||||
return new ApiException(response.statusCode(), message, response.headers(), 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;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -95,7 +100,7 @@ public class FakeClassnameTags123Api {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw createApiException(localVarResponse, "testClassname call received non-success response");
|
||||
throw getApiException("testClassname", localVarResponse);
|
||||
}
|
||||
return new ApiResponse<Client>(
|
||||
localVarResponse.statusCode(),
|
||||
|
||||
@@ -60,12 +60,17 @@ public class PetApi {
|
||||
memberVarResponseInterceptor = apiClient.getResponseInterceptor();
|
||||
}
|
||||
|
||||
protected ApiException createApiException(HttpResponse<InputStream> response, String msgPrefix) throws IOException {
|
||||
protected ApiException getApiException(String operationId, HttpResponse<InputStream> response) throws IOException {
|
||||
String body = response.body() == null ? null : new String(response.body().readAllBytes());
|
||||
if (body != null) {
|
||||
msgPrefix += ": " + body;
|
||||
String message = formatExceptionMessage(operationId, response.statusCode(), body);
|
||||
return new ApiException(response.statusCode(), message, response.headers(), 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;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -95,7 +100,7 @@ public class PetApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw createApiException(localVarResponse, "addPet call received non-success response");
|
||||
throw getApiException("addPet", localVarResponse);
|
||||
}
|
||||
return new ApiResponse<Void>(
|
||||
localVarResponse.statusCode(),
|
||||
@@ -169,7 +174,7 @@ public class PetApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw createApiException(localVarResponse, "deletePet call received non-success response");
|
||||
throw getApiException("deletePet", localVarResponse);
|
||||
}
|
||||
return new ApiResponse<Void>(
|
||||
localVarResponse.statusCode(),
|
||||
@@ -241,7 +246,7 @@ public class PetApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw createApiException(localVarResponse, "findPetsByStatus call received non-success response");
|
||||
throw getApiException("findPetsByStatus", localVarResponse);
|
||||
}
|
||||
return new ApiResponse<List<Pet>>(
|
||||
localVarResponse.statusCode(),
|
||||
@@ -322,7 +327,7 @@ public class PetApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw createApiException(localVarResponse, "findPetsByTags call received non-success response");
|
||||
throw getApiException("findPetsByTags", localVarResponse);
|
||||
}
|
||||
return new ApiResponse<List<Pet>>(
|
||||
localVarResponse.statusCode(),
|
||||
@@ -399,7 +404,7 @@ public class PetApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw createApiException(localVarResponse, "getPetById call received non-success response");
|
||||
throw getApiException("getPetById", localVarResponse);
|
||||
}
|
||||
return new ApiResponse<Pet>(
|
||||
localVarResponse.statusCode(),
|
||||
@@ -466,7 +471,7 @@ public class PetApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw createApiException(localVarResponse, "updatePet call received non-success response");
|
||||
throw getApiException("updatePet", localVarResponse);
|
||||
}
|
||||
return new ApiResponse<Void>(
|
||||
localVarResponse.statusCode(),
|
||||
@@ -542,7 +547,7 @@ public class PetApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw createApiException(localVarResponse, "updatePetWithForm call received non-success response");
|
||||
throw getApiException("updatePetWithForm", localVarResponse);
|
||||
}
|
||||
return new ApiResponse<Void>(
|
||||
localVarResponse.statusCode(),
|
||||
@@ -615,7 +620,7 @@ public class PetApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw createApiException(localVarResponse, "uploadFile call received non-success response");
|
||||
throw getApiException("uploadFile", localVarResponse);
|
||||
}
|
||||
return new ApiResponse<ModelApiResponse>(
|
||||
localVarResponse.statusCode(),
|
||||
@@ -688,7 +693,7 @@ public class PetApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw createApiException(localVarResponse, "uploadFileWithRequiredFile call received non-success response");
|
||||
throw getApiException("uploadFileWithRequiredFile", localVarResponse);
|
||||
}
|
||||
return new ApiResponse<ModelApiResponse>(
|
||||
localVarResponse.statusCode(),
|
||||
|
||||
@@ -58,12 +58,17 @@ public class StoreApi {
|
||||
memberVarResponseInterceptor = apiClient.getResponseInterceptor();
|
||||
}
|
||||
|
||||
protected ApiException createApiException(HttpResponse<InputStream> response, String msgPrefix) throws IOException {
|
||||
protected ApiException getApiException(String operationId, HttpResponse<InputStream> response) throws IOException {
|
||||
String body = response.body() == null ? null : new String(response.body().readAllBytes());
|
||||
if (body != null) {
|
||||
msgPrefix += ": " + body;
|
||||
String message = formatExceptionMessage(operationId, response.statusCode(), body);
|
||||
return new ApiException(response.statusCode(), message, response.headers(), 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;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -93,7 +98,7 @@ public class StoreApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw createApiException(localVarResponse, "deleteOrder call received non-success response");
|
||||
throw getApiException("deleteOrder", localVarResponse);
|
||||
}
|
||||
return new ApiResponse<Void>(
|
||||
localVarResponse.statusCode(),
|
||||
@@ -160,7 +165,7 @@ public class StoreApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw createApiException(localVarResponse, "getInventory call received non-success response");
|
||||
throw getApiException("getInventory", localVarResponse);
|
||||
}
|
||||
return new ApiResponse<Map<String, Integer>>(
|
||||
localVarResponse.statusCode(),
|
||||
@@ -224,7 +229,7 @@ public class StoreApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw createApiException(localVarResponse, "getOrderById call received non-success response");
|
||||
throw getApiException("getOrderById", localVarResponse);
|
||||
}
|
||||
return new ApiResponse<Order>(
|
||||
localVarResponse.statusCode(),
|
||||
@@ -293,7 +298,7 @@ public class StoreApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw createApiException(localVarResponse, "placeOrder call received non-success response");
|
||||
throw getApiException("placeOrder", localVarResponse);
|
||||
}
|
||||
return new ApiResponse<Order>(
|
||||
localVarResponse.statusCode(),
|
||||
|
||||
@@ -58,12 +58,17 @@ public class UserApi {
|
||||
memberVarResponseInterceptor = apiClient.getResponseInterceptor();
|
||||
}
|
||||
|
||||
protected ApiException createApiException(HttpResponse<InputStream> response, String msgPrefix) throws IOException {
|
||||
protected ApiException getApiException(String operationId, HttpResponse<InputStream> response) throws IOException {
|
||||
String body = response.body() == null ? null : new String(response.body().readAllBytes());
|
||||
if (body != null) {
|
||||
msgPrefix += ": " + body;
|
||||
String message = formatExceptionMessage(operationId, response.statusCode(), body);
|
||||
return new ApiException(response.statusCode(), message, response.headers(), 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;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -93,7 +98,7 @@ public class UserApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw createApiException(localVarResponse, "createUser call received non-success response");
|
||||
throw getApiException("createUser", localVarResponse);
|
||||
}
|
||||
return new ApiResponse<Void>(
|
||||
localVarResponse.statusCode(),
|
||||
@@ -165,7 +170,7 @@ public class UserApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw createApiException(localVarResponse, "createUsersWithArrayInput call received non-success response");
|
||||
throw getApiException("createUsersWithArrayInput", localVarResponse);
|
||||
}
|
||||
return new ApiResponse<Void>(
|
||||
localVarResponse.statusCode(),
|
||||
@@ -237,7 +242,7 @@ public class UserApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw createApiException(localVarResponse, "createUsersWithListInput call received non-success response");
|
||||
throw getApiException("createUsersWithListInput", localVarResponse);
|
||||
}
|
||||
return new ApiResponse<Void>(
|
||||
localVarResponse.statusCode(),
|
||||
@@ -309,7 +314,7 @@ public class UserApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw createApiException(localVarResponse, "deleteUser call received non-success response");
|
||||
throw getApiException("deleteUser", localVarResponse);
|
||||
}
|
||||
return new ApiResponse<Void>(
|
||||
localVarResponse.statusCode(),
|
||||
@@ -378,7 +383,7 @@ public class UserApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw createApiException(localVarResponse, "getUserByName call received non-success response");
|
||||
throw getApiException("getUserByName", localVarResponse);
|
||||
}
|
||||
return new ApiResponse<User>(
|
||||
localVarResponse.statusCode(),
|
||||
@@ -449,7 +454,7 @@ public class UserApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw createApiException(localVarResponse, "loginUser call received non-success response");
|
||||
throw getApiException("loginUser", localVarResponse);
|
||||
}
|
||||
return new ApiResponse<String>(
|
||||
localVarResponse.statusCode(),
|
||||
@@ -527,7 +532,7 @@ public class UserApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw createApiException(localVarResponse, "logoutUser call received non-success response");
|
||||
throw getApiException("logoutUser", localVarResponse);
|
||||
}
|
||||
return new ApiResponse<Void>(
|
||||
localVarResponse.statusCode(),
|
||||
@@ -591,7 +596,7 @@ public class UserApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw createApiException(localVarResponse, "updateUser call received non-success response");
|
||||
throw getApiException("updateUser", localVarResponse);
|
||||
}
|
||||
return new ApiResponse<Void>(
|
||||
localVarResponse.statusCode(),
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -31,8 +31,6 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
|
||||
import javax.ws.rs.core.GenericType;
|
||||
import javax.ws.rs.core.Response;
|
||||
import java.io.IOException;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
@@ -44,7 +42,6 @@ import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
import com.fasterxml.jackson.databind.JsonMappingException;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
@@ -163,7 +160,7 @@ public class Fruit extends AbstractOpenApiSchema {
|
||||
}
|
||||
|
||||
// store a list of schema names defined in oneOf
|
||||
public static final Map<String, GenericType> schemas = new HashMap<String, GenericType>();
|
||||
public static final Map<String, Class<?>> schemas = new HashMap<>();
|
||||
|
||||
public Fruit() {
|
||||
super("oneOf", Boolean.FALSE);
|
||||
@@ -180,15 +177,13 @@ public class Fruit extends AbstractOpenApiSchema {
|
||||
}
|
||||
|
||||
static {
|
||||
schemas.put("Apple", new GenericType<Apple>() {
|
||||
});
|
||||
schemas.put("Banana", new GenericType<Banana>() {
|
||||
});
|
||||
schemas.put("Apple", Apple.class);
|
||||
schemas.put("Banana", Banana.class);
|
||||
JSON.registerDescendants(Fruit.class, Collections.unmodifiableMap(schemas));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, GenericType> getSchemas() {
|
||||
public Map<String, Class<?>> getSchemas() {
|
||||
return Fruit.schemas;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,8 +31,6 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
|
||||
import javax.ws.rs.core.GenericType;
|
||||
import javax.ws.rs.core.Response;
|
||||
import java.io.IOException;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
@@ -44,7 +42,6 @@ import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
import com.fasterxml.jackson.databind.JsonMappingException;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
@@ -165,7 +162,7 @@ public class FruitReq extends AbstractOpenApiSchema {
|
||||
}
|
||||
|
||||
// store a list of schema names defined in oneOf
|
||||
public static final Map<String, GenericType> schemas = new HashMap<String, GenericType>();
|
||||
public static final Map<String, Class<?>> schemas = new HashMap<>();
|
||||
|
||||
public FruitReq() {
|
||||
super("oneOf", Boolean.TRUE);
|
||||
@@ -182,15 +179,13 @@ public class FruitReq extends AbstractOpenApiSchema {
|
||||
}
|
||||
|
||||
static {
|
||||
schemas.put("AppleReq", new GenericType<AppleReq>() {
|
||||
});
|
||||
schemas.put("BananaReq", new GenericType<BananaReq>() {
|
||||
});
|
||||
schemas.put("AppleReq", AppleReq.class);
|
||||
schemas.put("BananaReq", BananaReq.class);
|
||||
JSON.registerDescendants(FruitReq.class, Collections.unmodifiableMap(schemas));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, GenericType> getSchemas() {
|
||||
public Map<String, Class<?>> getSchemas() {
|
||||
return FruitReq.schemas;
|
||||
}
|
||||
|
||||
|
||||
@@ -30,8 +30,6 @@ import org.openapitools.client.model.Banana;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
|
||||
|
||||
import javax.ws.rs.core.GenericType;
|
||||
import javax.ws.rs.core.Response;
|
||||
import java.io.IOException;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
@@ -42,7 +40,6 @@ import java.util.HashSet;
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
import com.fasterxml.jackson.databind.JsonMappingException;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
@@ -123,7 +120,7 @@ public class GmFruit extends AbstractOpenApiSchema {
|
||||
}
|
||||
|
||||
// store a list of schema names defined in anyOf
|
||||
public static final Map<String, GenericType> schemas = new HashMap<String, GenericType>();
|
||||
public static final Map<String, Class<?>> schemas = new HashMap<String, Class<?>>();
|
||||
|
||||
public GmFruit() {
|
||||
super("anyOf", Boolean.FALSE);
|
||||
@@ -140,15 +137,13 @@ public class GmFruit extends AbstractOpenApiSchema {
|
||||
}
|
||||
|
||||
static {
|
||||
schemas.put("Apple", new GenericType<Apple>() {
|
||||
});
|
||||
schemas.put("Banana", new GenericType<Banana>() {
|
||||
});
|
||||
schemas.put("Apple", Apple.class);
|
||||
schemas.put("Banana", Banana.class);
|
||||
JSON.registerDescendants(GmFruit.class, Collections.unmodifiableMap(schemas));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, GenericType> getSchemas() {
|
||||
public Map<String, Class<?>> getSchemas() {
|
||||
return GmFruit.schemas;
|
||||
}
|
||||
|
||||
|
||||
@@ -33,8 +33,6 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
|
||||
import javax.ws.rs.core.GenericType;
|
||||
import javax.ws.rs.core.Response;
|
||||
import java.io.IOException;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
@@ -46,7 +44,6 @@ import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
import com.fasterxml.jackson.databind.JsonMappingException;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
@@ -211,7 +208,7 @@ public class Mammal extends AbstractOpenApiSchema {
|
||||
}
|
||||
|
||||
// store a list of schema names defined in oneOf
|
||||
public static final Map<String, GenericType> schemas = new HashMap<String, GenericType>();
|
||||
public static final Map<String, Class<?>> schemas = new HashMap<>();
|
||||
|
||||
public Mammal() {
|
||||
super("oneOf", Boolean.FALSE);
|
||||
@@ -233,12 +230,9 @@ public class Mammal extends AbstractOpenApiSchema {
|
||||
}
|
||||
|
||||
static {
|
||||
schemas.put("Pig", new GenericType<Pig>() {
|
||||
});
|
||||
schemas.put("Whale", new GenericType<Whale>() {
|
||||
});
|
||||
schemas.put("Zebra", new GenericType<Zebra>() {
|
||||
});
|
||||
schemas.put("Pig", Pig.class);
|
||||
schemas.put("Whale", Whale.class);
|
||||
schemas.put("Zebra", Zebra.class);
|
||||
JSON.registerDescendants(Mammal.class, Collections.unmodifiableMap(schemas));
|
||||
// Initialize and register the discriminator mappings.
|
||||
Map<String, Class<?>> mappings = new HashMap<String, Class<?>>();
|
||||
@@ -250,7 +244,7 @@ public class Mammal extends AbstractOpenApiSchema {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, GenericType> getSchemas() {
|
||||
public Map<String, Class<?>> getSchemas() {
|
||||
return Mammal.schemas;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,8 +32,6 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
|
||||
import javax.ws.rs.core.GenericType;
|
||||
import javax.ws.rs.core.Response;
|
||||
import java.io.IOException;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
@@ -45,7 +43,6 @@ import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
import com.fasterxml.jackson.databind.JsonMappingException;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
@@ -182,7 +179,7 @@ public class NullableShape extends AbstractOpenApiSchema {
|
||||
}
|
||||
|
||||
// store a list of schema names defined in oneOf
|
||||
public static final Map<String, GenericType> schemas = new HashMap<String, GenericType>();
|
||||
public static final Map<String, Class<?>> schemas = new HashMap<>();
|
||||
|
||||
public NullableShape() {
|
||||
super("oneOf", Boolean.TRUE);
|
||||
@@ -199,10 +196,8 @@ public class NullableShape extends AbstractOpenApiSchema {
|
||||
}
|
||||
|
||||
static {
|
||||
schemas.put("Quadrilateral", new GenericType<Quadrilateral>() {
|
||||
});
|
||||
schemas.put("Triangle", new GenericType<Triangle>() {
|
||||
});
|
||||
schemas.put("Quadrilateral", Quadrilateral.class);
|
||||
schemas.put("Triangle", Triangle.class);
|
||||
JSON.registerDescendants(NullableShape.class, Collections.unmodifiableMap(schemas));
|
||||
// Initialize and register the discriminator mappings.
|
||||
Map<String, Class<?>> mappings = new HashMap<String, Class<?>>();
|
||||
@@ -213,7 +208,7 @@ public class NullableShape extends AbstractOpenApiSchema {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, GenericType> getSchemas() {
|
||||
public Map<String, Class<?>> getSchemas() {
|
||||
return NullableShape.schemas;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,8 +32,6 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
|
||||
import javax.ws.rs.core.GenericType;
|
||||
import javax.ws.rs.core.Response;
|
||||
import java.io.IOException;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
@@ -45,7 +43,6 @@ import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
import com.fasterxml.jackson.databind.JsonMappingException;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
@@ -180,7 +177,7 @@ public class Pig extends AbstractOpenApiSchema {
|
||||
}
|
||||
|
||||
// store a list of schema names defined in oneOf
|
||||
public static final Map<String, GenericType> schemas = new HashMap<String, GenericType>();
|
||||
public static final Map<String, Class<?>> schemas = new HashMap<>();
|
||||
|
||||
public Pig() {
|
||||
super("oneOf", Boolean.FALSE);
|
||||
@@ -197,10 +194,8 @@ public class Pig extends AbstractOpenApiSchema {
|
||||
}
|
||||
|
||||
static {
|
||||
schemas.put("BasquePig", new GenericType<BasquePig>() {
|
||||
});
|
||||
schemas.put("DanishPig", new GenericType<DanishPig>() {
|
||||
});
|
||||
schemas.put("BasquePig", BasquePig.class);
|
||||
schemas.put("DanishPig", DanishPig.class);
|
||||
JSON.registerDescendants(Pig.class, Collections.unmodifiableMap(schemas));
|
||||
// Initialize and register the discriminator mappings.
|
||||
Map<String, Class<?>> mappings = new HashMap<String, Class<?>>();
|
||||
@@ -211,7 +206,7 @@ public class Pig extends AbstractOpenApiSchema {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, GenericType> getSchemas() {
|
||||
public Map<String, Class<?>> getSchemas() {
|
||||
return Pig.schemas;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,8 +32,6 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
|
||||
import javax.ws.rs.core.GenericType;
|
||||
import javax.ws.rs.core.Response;
|
||||
import java.io.IOException;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
@@ -45,7 +43,6 @@ import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
import com.fasterxml.jackson.databind.JsonMappingException;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
@@ -180,7 +177,7 @@ public class Quadrilateral extends AbstractOpenApiSchema {
|
||||
}
|
||||
|
||||
// store a list of schema names defined in oneOf
|
||||
public static final Map<String, GenericType> schemas = new HashMap<String, GenericType>();
|
||||
public static final Map<String, Class<?>> schemas = new HashMap<>();
|
||||
|
||||
public Quadrilateral() {
|
||||
super("oneOf", Boolean.FALSE);
|
||||
@@ -197,10 +194,8 @@ public class Quadrilateral extends AbstractOpenApiSchema {
|
||||
}
|
||||
|
||||
static {
|
||||
schemas.put("ComplexQuadrilateral", new GenericType<ComplexQuadrilateral>() {
|
||||
});
|
||||
schemas.put("SimpleQuadrilateral", new GenericType<SimpleQuadrilateral>() {
|
||||
});
|
||||
schemas.put("ComplexQuadrilateral", ComplexQuadrilateral.class);
|
||||
schemas.put("SimpleQuadrilateral", SimpleQuadrilateral.class);
|
||||
JSON.registerDescendants(Quadrilateral.class, Collections.unmodifiableMap(schemas));
|
||||
// Initialize and register the discriminator mappings.
|
||||
Map<String, Class<?>> mappings = new HashMap<String, Class<?>>();
|
||||
@@ -211,7 +206,7 @@ public class Quadrilateral extends AbstractOpenApiSchema {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, GenericType> getSchemas() {
|
||||
public Map<String, Class<?>> getSchemas() {
|
||||
return Quadrilateral.schemas;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,8 +32,6 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
|
||||
import javax.ws.rs.core.GenericType;
|
||||
import javax.ws.rs.core.Response;
|
||||
import java.io.IOException;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
@@ -45,7 +43,6 @@ import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
import com.fasterxml.jackson.databind.JsonMappingException;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
@@ -180,7 +177,7 @@ public class Shape extends AbstractOpenApiSchema {
|
||||
}
|
||||
|
||||
// store a list of schema names defined in oneOf
|
||||
public static final Map<String, GenericType> schemas = new HashMap<String, GenericType>();
|
||||
public static final Map<String, Class<?>> schemas = new HashMap<>();
|
||||
|
||||
public Shape() {
|
||||
super("oneOf", Boolean.FALSE);
|
||||
@@ -197,10 +194,8 @@ public class Shape extends AbstractOpenApiSchema {
|
||||
}
|
||||
|
||||
static {
|
||||
schemas.put("Quadrilateral", new GenericType<Quadrilateral>() {
|
||||
});
|
||||
schemas.put("Triangle", new GenericType<Triangle>() {
|
||||
});
|
||||
schemas.put("Quadrilateral", Quadrilateral.class);
|
||||
schemas.put("Triangle", Triangle.class);
|
||||
JSON.registerDescendants(Shape.class, Collections.unmodifiableMap(schemas));
|
||||
// Initialize and register the discriminator mappings.
|
||||
Map<String, Class<?>> mappings = new HashMap<String, Class<?>>();
|
||||
@@ -211,7 +206,7 @@ public class Shape extends AbstractOpenApiSchema {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, GenericType> getSchemas() {
|
||||
public Map<String, Class<?>> getSchemas() {
|
||||
return Shape.schemas;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,8 +32,6 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
|
||||
import javax.ws.rs.core.GenericType;
|
||||
import javax.ws.rs.core.Response;
|
||||
import java.io.IOException;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
@@ -45,7 +43,6 @@ import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
import com.fasterxml.jackson.databind.JsonMappingException;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
@@ -182,7 +179,7 @@ public class ShapeOrNull extends AbstractOpenApiSchema {
|
||||
}
|
||||
|
||||
// store a list of schema names defined in oneOf
|
||||
public static final Map<String, GenericType> schemas = new HashMap<String, GenericType>();
|
||||
public static final Map<String, Class<?>> schemas = new HashMap<>();
|
||||
|
||||
public ShapeOrNull() {
|
||||
super("oneOf", Boolean.TRUE);
|
||||
@@ -199,10 +196,8 @@ public class ShapeOrNull extends AbstractOpenApiSchema {
|
||||
}
|
||||
|
||||
static {
|
||||
schemas.put("Quadrilateral", new GenericType<Quadrilateral>() {
|
||||
});
|
||||
schemas.put("Triangle", new GenericType<Triangle>() {
|
||||
});
|
||||
schemas.put("Quadrilateral", Quadrilateral.class);
|
||||
schemas.put("Triangle", Triangle.class);
|
||||
JSON.registerDescendants(ShapeOrNull.class, Collections.unmodifiableMap(schemas));
|
||||
// Initialize and register the discriminator mappings.
|
||||
Map<String, Class<?>> mappings = new HashMap<String, Class<?>>();
|
||||
@@ -213,7 +208,7 @@ public class ShapeOrNull extends AbstractOpenApiSchema {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, GenericType> getSchemas() {
|
||||
public Map<String, Class<?>> getSchemas() {
|
||||
return ShapeOrNull.schemas;
|
||||
}
|
||||
|
||||
|
||||
@@ -33,8 +33,6 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
|
||||
import javax.ws.rs.core.GenericType;
|
||||
import javax.ws.rs.core.Response;
|
||||
import java.io.IOException;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
@@ -46,7 +44,6 @@ import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
import com.fasterxml.jackson.databind.JsonMappingException;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
@@ -211,7 +208,7 @@ public class Triangle extends AbstractOpenApiSchema {
|
||||
}
|
||||
|
||||
// store a list of schema names defined in oneOf
|
||||
public static final Map<String, GenericType> schemas = new HashMap<String, GenericType>();
|
||||
public static final Map<String, Class<?>> schemas = new HashMap<>();
|
||||
|
||||
public Triangle() {
|
||||
super("oneOf", Boolean.FALSE);
|
||||
@@ -233,12 +230,9 @@ public class Triangle extends AbstractOpenApiSchema {
|
||||
}
|
||||
|
||||
static {
|
||||
schemas.put("EquilateralTriangle", new GenericType<EquilateralTriangle>() {
|
||||
});
|
||||
schemas.put("IsoscelesTriangle", new GenericType<IsoscelesTriangle>() {
|
||||
});
|
||||
schemas.put("ScaleneTriangle", new GenericType<ScaleneTriangle>() {
|
||||
});
|
||||
schemas.put("EquilateralTriangle", EquilateralTriangle.class);
|
||||
schemas.put("IsoscelesTriangle", IsoscelesTriangle.class);
|
||||
schemas.put("ScaleneTriangle", ScaleneTriangle.class);
|
||||
JSON.registerDescendants(Triangle.class, Collections.unmodifiableMap(schemas));
|
||||
// Initialize and register the discriminator mappings.
|
||||
Map<String, Class<?>> mappings = new HashMap<String, Class<?>>();
|
||||
@@ -250,7 +244,7 @@ public class Triangle extends AbstractOpenApiSchema {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, GenericType> getSchemas() {
|
||||
public Map<String, Class<?>> getSchemas() {
|
||||
return Triangle.schemas;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user