Merge remote-tracking branch 'origin/3.2.x' into 4.0.x

This commit is contained in:
Jeremie Bresson
2018-07-18 12:32:55 +02:00
255 changed files with 8075 additions and 1622 deletions

View File

@@ -26,7 +26,8 @@ import io.swagger.annotations.ApiModelProperty;
/**
* Animal
*/
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true )
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true)
@JsonSubTypes({
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),

View File

@@ -26,7 +26,8 @@ import io.swagger.annotations.ApiModelProperty;
/**
* Animal
*/
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true )
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true)
@JsonSubTypes({
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),

View File

@@ -26,7 +26,8 @@ import io.swagger.annotations.ApiModelProperty;
/**
* Animal
*/
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true )
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true)
@JsonSubTypes({
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),

View File

@@ -12,7 +12,7 @@ This spec is mainly for testing Petstore server and contains fake endpoints, mod
## Requirements
Building the API client library requires:
1. Java 1.7+
1. Java 1.6+
2. Maven/Gradle
## Installation
@@ -108,6 +108,7 @@ Class | Method | HTTP request | Description
*FakeApi* | [**fakeOuterCompositeSerialize**](docs/FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite |
*FakeApi* | [**fakeOuterNumberSerialize**](docs/FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number |
*FakeApi* | [**fakeOuterStringSerialize**](docs/FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string |
*FakeApi* | [**testBodyWithFileSchema**](docs/FakeApi.md#testBodyWithFileSchema) | **PUT** /fake/body-with-file-schema |
*FakeApi* | [**testBodyWithQueryParams**](docs/FakeApi.md#testBodyWithQueryParams) | **PUT** /fake/body-with-query-params |
*FakeApi* | [**testClientModel**](docs/FakeApi.md#testClientModel) | **PATCH** /fake | To test \"client\" model
*FakeApi* | [**testEndpointParameters**](docs/FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
@@ -123,6 +124,7 @@ Class | Method | HTTP request | Description
*PetApi* | [**updatePet**](docs/PetApi.md#updatePet) | **PUT** /pet | Update an existing pet
*PetApi* | [**updatePetWithForm**](docs/PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data
*PetApi* | [**uploadFile**](docs/PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image
*PetApi* | [**uploadFileWithRequiredFile**](docs/PetApi.md#uploadFileWithRequiredFile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required)
*StoreApi* | [**deleteOrder**](docs/StoreApi.md#deleteOrder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID
*StoreApi* | [**getInventory**](docs/StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status
*StoreApi* | [**getOrderById**](docs/StoreApi.md#getOrderById) | **GET** /store/order/{order_id} | Find purchase order by ID
@@ -154,6 +156,7 @@ Class | Method | HTTP request | Description
- [EnumArrays](docs/EnumArrays.md)
- [EnumClass](docs/EnumClass.md)
- [EnumTest](docs/EnumTest.md)
- [FileSchemaTestClass](docs/FileSchemaTestClass.md)
- [FormatTest](docs/FormatTest.md)
- [HasOnlyReadOnly](docs/HasOnlyReadOnly.md)
- [MapTest](docs/MapTest.md)
@@ -169,6 +172,7 @@ Class | Method | HTTP request | Description
- [Pet](docs/Pet.md)
- [ReadOnlyFirst](docs/ReadOnlyFirst.md)
- [SpecialModelName](docs/SpecialModelName.md)
- [StringBooleanMap](docs/StringBooleanMap.md)
- [Tag](docs/Tag.md)
- [User](docs/User.md)

View File

@@ -6,7 +6,9 @@ version = '1.0.0'
buildscript {
repositories {
jcenter()
jcenter {
url "http://jcenter.bintray.com/"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.+'
@@ -15,7 +17,9 @@ buildscript {
}
repositories {
jcenter()
jcenter {
url "http://jcenter.bintray.com/"
}
}
@@ -32,8 +36,8 @@ if(hasProperty('target') && target == 'android') {
targetSdkVersion 25
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
sourceCompatibility JavaVersion.VERSION_1_6
targetCompatibility JavaVersion.VERSION_1_6
}
// Rename the aar correctly
@@ -77,8 +81,8 @@ if(hasProperty('target') && target == 'android') {
apply plugin: 'java'
apply plugin: 'maven'
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
sourceCompatibility = JavaVersion.VERSION_1_6
targetCompatibility = JavaVersion.VERSION_1_6
install {
repositories.mavenInstaller {
@@ -93,12 +97,13 @@ if(hasProperty('target') && target == 'android') {
}
ext {
swagger_annotations_version = "1.5.17"
jackson_version = "2.8.9"
swagger_annotations_version = "1.5.20"
jackson_version = "2.9.6"
jersey_version = "2.6"
commons_io_version=2.5
commons_lang3_version=3.6
junit_version = "4.12"
threetenbp_version = "2.6.4"
}
dependencies {
@@ -111,7 +116,7 @@ dependencies {
compile "com.fasterxml.jackson.core:jackson-databind:$jackson_version"
compile "commons-io:commons-io:$commons_io_version"
compile "org.apache.commons:commons-lang3:$commons_lang3_version"
compile "com.github.joschi.jackson:jackson-datatype-threetenbp:$jackson_version",
compile "com.github.joschi.jackson:jackson-datatype-threetenbp:$threetenbp_version"
compile "com.brsanthu:migbase64:2.2"
testCompile "junit:junit:$junit_version"
}

View File

@@ -9,13 +9,13 @@ lazy val root = (project in file(".")).
publishArtifact in (Compile, packageDoc) := false,
resolvers += Resolver.mavenLocal,
libraryDependencies ++= Seq(
"io.swagger" % "swagger-annotations" % "1.5.17",
"io.swagger" % "swagger-annotations" % "1.5.20",
"org.glassfish.jersey.core" % "jersey-client" % "2.6",
"org.glassfish.jersey.media" % "jersey-media-multipart" % "2.6",
"org.glassfish.jersey.media" % "jersey-media-json-jackson" % "2.6",
"com.fasterxml.jackson.core" % "jackson-core" % "2.6.4" % "compile",
"com.fasterxml.jackson.core" % "jackson-annotations" % "2.6.4" % "compile",
"com.fasterxml.jackson.core" % "jackson-databind" % "2.6.4" % "compile",
"com.fasterxml.jackson.core" % "jackson-core" % "2.8.9" % "compile",
"com.fasterxml.jackson.core" % "jackson-annotations" % "2.8.9" % "compile",
"com.fasterxml.jackson.core" % "jackson-databind" % "2.8.9" % "compile",
"com.github.joschi.jackson" % "jackson-datatype-threetenbp" % "2.6.4" % "compile",
"com.brsanthu" % "migbase64" % "2.2",
"org.apache.commons" % "commons-lang3" % "3.6",

View File

@@ -139,8 +139,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
@@ -239,7 +239,7 @@
<dependency>
<groupId>com.github.joschi.jackson</groupId>
<artifactId>jackson-datatype-threetenbp</artifactId>
<version>${jackson-version}</version>
<version>${threetenbp-version}</version>
</dependency>
<!-- Base64 encoding that works in both JVM and Android -->
<dependency>
@@ -267,11 +267,12 @@
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<swagger-core-version>1.5.18</swagger-core-version>
<jersey-version>2.6</jersey-version>
<commons_io_version>2.5</commons_io_version>
<commons_lang3_version>3.6</commons_lang3_version>
<jackson-version>2.6.4</jackson-version>
<swagger-core-version>1.5.20</swagger-core-version>
<jersey-version>2.6</jersey-version>
<commons_io_version>2.5</commons_io_version>
<commons_lang3_version>3.6</commons_lang3_version>
<jackson-version>2.8.9</jackson-version>
<threetenbp-version>2.6.4</threetenbp-version>
<maven-plugin-version>1.0.0</maven-plugin-version>
<junit-version>4.12</junit-version>
</properties>

View File

@@ -698,12 +698,12 @@ public class ApiClient {
Map<String, List<String>> responseHeaders = buildResponseHeaders(response);
if (response.getStatus() == Status.NO_CONTENT.getStatusCode()) {
return new ApiResponse<>(statusCode, responseHeaders);
return new ApiResponse<T>(statusCode, responseHeaders);
} else if (response.getStatusInfo().getFamily() == Status.Family.SUCCESSFUL) {
if (returnType == null)
return new ApiResponse<>(statusCode, responseHeaders);
return new ApiResponse<T>(statusCode, responseHeaders);
else
return new ApiResponse<>(statusCode, responseHeaders, deserialize(response, returnType));
return new ApiResponse<T>(statusCode, responseHeaders, deserialize(response, returnType));
} else {
String message = "error";
String respBody = null;

View File

@@ -25,7 +25,8 @@ import io.swagger.annotations.ApiModelProperty;
/**
* Animal
*/
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true )
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true)
@JsonSubTypes({
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),

View File

@@ -17,6 +17,7 @@ import org.openapitools.client.ApiException;
import java.math.BigDecimal;
import org.openapitools.client.model.Client;
import java.io.File;
import org.openapitools.client.model.FileSchemaTestClass;
import org.threeten.bp.LocalDate;
import org.threeten.bp.OffsetDateTime;
import org.openapitools.client.model.OuterComposite;
@@ -102,6 +103,22 @@ public class FakeApiTest {
// TODO: test validations
}
/**
*
*
* For this test, the body for this request much reference a schema named &#x60;File&#x60;.
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void testBodyWithFileSchemaTest() throws ApiException {
FileSchemaTestClass fileSchemaTestClass = null;
api.testBodyWithFileSchema(fileSchemaTestClass);
// TODO: test validations
}
/**
*
*

View File

@@ -167,4 +167,22 @@ public class PetApiTest {
// TODO: test validations
}
/**
* uploads an image (required)
*
*
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void uploadFileWithRequiredFileTest() throws ApiException {
Long petId = null;
File requiredFile = null;
String additionalMetadata = null;
ModelApiResponse response = api.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata);
// TODO: test validations
}
}

View File

@@ -93,9 +93,9 @@ if(hasProperty('target') && target == 'android') {
}
ext {
swagger_annotations_version = "1.5.17"
jackson_version = "2.8.9"
jersey_version = "2.25.1"
swagger_annotations_version = "1.5.20"
jackson_version = "2.9.6"
jersey_version = "2.27"
junit_version = "4.12"
}
@@ -107,6 +107,6 @@ dependencies {
compile "com.fasterxml.jackson.core:jackson-core:$jackson_version"
compile "com.fasterxml.jackson.core:jackson-annotations:$jackson_version"
compile "com.fasterxml.jackson.core:jackson-databind:$jackson_version"
compile "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version",
compile "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version"
testCompile "junit:junit:$junit_version"
}

View File

@@ -9,7 +9,7 @@ lazy val root = (project in file(".")).
publishArtifact in (Compile, packageDoc) := false,
resolvers += Resolver.mavenLocal,
libraryDependencies ++= Seq(
"io.swagger" % "swagger-annotations" % "1.5.17",
"io.swagger" % "swagger-annotations" % "1.5.20",
"org.glassfish.jersey.core" % "jersey-client" % "2.25.1",
"org.glassfish.jersey.media" % "jersey-media-multipart" % "2.25.1",
"org.glassfish.jersey.media" % "jersey-media-json-jackson" % "2.25.1",

View File

@@ -251,9 +251,9 @@
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<swagger-core-version>1.5.18</swagger-core-version>
<jersey-version>2.25.1</jersey-version>
<jackson-version>2.7.5</jackson-version>
<swagger-core-version>1.5.20</swagger-core-version>
<jersey-version>2.27</jersey-version>
<jackson-version>2.8.9</jackson-version>
<maven-plugin-version>1.0.0</maven-plugin-version>
<junit-version>4.12</junit-version>
</properties>

View File

@@ -26,7 +26,8 @@ import io.swagger.annotations.ApiModelProperty;
/**
* Animal
*/
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true )
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true)
@JsonSubTypes({
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),

View File

@@ -93,10 +93,11 @@ if(hasProperty('target') && target == 'android') {
}
ext {
swagger_annotations_version = "1.5.17"
jackson_version = "2.8.9"
jersey_version = "2.25.1"
swagger_annotations_version = "1.5.20"
jackson_version = "2.9.6"
jersey_version = "2.27"
junit_version = "4.12"
threetenbp_version = "2.6.4"
}
dependencies {
@@ -107,7 +108,7 @@ dependencies {
compile "com.fasterxml.jackson.core:jackson-core:$jackson_version"
compile "com.fasterxml.jackson.core:jackson-annotations:$jackson_version"
compile "com.fasterxml.jackson.core:jackson-databind:$jackson_version"
compile "com.github.joschi.jackson:jackson-datatype-threetenbp:$jackson_version",
compile "com.github.joschi.jackson:jackson-datatype-threetenbp:$threetenbp_version"
compile "com.brsanthu:migbase64:2.2"
testCompile "junit:junit:$junit_version"
}

View File

@@ -9,13 +9,13 @@ lazy val root = (project in file(".")).
publishArtifact in (Compile, packageDoc) := false,
resolvers += Resolver.mavenLocal,
libraryDependencies ++= Seq(
"io.swagger" % "swagger-annotations" % "1.5.17",
"io.swagger" % "swagger-annotations" % "1.5.20",
"org.glassfish.jersey.core" % "jersey-client" % "2.25.1",
"org.glassfish.jersey.media" % "jersey-media-multipart" % "2.25.1",
"org.glassfish.jersey.media" % "jersey-media-json-jackson" % "2.25.1",
"com.fasterxml.jackson.core" % "jackson-core" % "2.6.4" % "compile",
"com.fasterxml.jackson.core" % "jackson-annotations" % "2.6.4" % "compile",
"com.fasterxml.jackson.core" % "jackson-databind" % "2.6.4" % "compile",
"com.fasterxml.jackson.core" % "jackson-core" % "2.8.9" % "compile",
"com.fasterxml.jackson.core" % "jackson-annotations" % "2.8.9" % "compile",
"com.fasterxml.jackson.core" % "jackson-databind" % "2.8.9" % "compile",
"com.github.joschi.jackson" % "jackson-datatype-threetenbp" % "2.6.4" % "compile",
"com.brsanthu" % "migbase64" % "2.2",
"junit" % "junit" % "4.12" % "test",

View File

@@ -239,7 +239,7 @@
<dependency>
<groupId>com.github.joschi.jackson</groupId>
<artifactId>jackson-datatype-threetenbp</artifactId>
<version>${jackson-version}</version>
<version>${threetenbp-version}</version>
</dependency>
<!-- Base64 encoding that works in both JVM and Android -->
<dependency>
@@ -257,9 +257,10 @@
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<swagger-core-version>1.5.18</swagger-core-version>
<jersey-version>2.25.1</jersey-version>
<jackson-version>2.6.4</jackson-version>
<swagger-core-version>1.5.20</swagger-core-version>
<jersey-version>2.27</jersey-version>
<jackson-version>2.8.9</jackson-version>
<threetenbp-version>2.6.4</threetenbp-version>
<maven-plugin-version>1.0.0</maven-plugin-version>
<junit-version>4.12</junit-version>
</properties>

View File

@@ -26,7 +26,8 @@ import io.swagger.annotations.ApiModelProperty;
/**
* Animal
*/
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true )
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true)
@JsonSubTypes({
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),

View File

@@ -55,14 +55,15 @@ public class JSON {
@Override
public Class getClassForElement(JsonElement readElement) {
Map classByDiscriminatorValue = new HashMap();
classByDiscriminatorValue.put("Cat".toUpperCase(), Cat.class);
classByDiscriminatorValue.put("Dog".toUpperCase(), Dog.class);
classByDiscriminatorValue.put("Cat".toUpperCase(), Cat.class);
classByDiscriminatorValue.put("Animal".toUpperCase(), Animal.class);
return getClassByDiscriminator(
classByDiscriminatorValue,
getDiscriminatorValue(readElement, ""));
getDiscriminatorValue(readElement, "className"));
}
})
;
GsonBuilder builder = fireBuilder.createGsonBuilder();
return builder;

View File

@@ -55,14 +55,15 @@ public class JSON {
@Override
public Class getClassForElement(JsonElement readElement) {
Map classByDiscriminatorValue = new HashMap();
classByDiscriminatorValue.put("Cat".toUpperCase(), Cat.class);
classByDiscriminatorValue.put("Dog".toUpperCase(), Dog.class);
classByDiscriminatorValue.put("Cat".toUpperCase(), Cat.class);
classByDiscriminatorValue.put("Animal".toUpperCase(), Animal.class);
return getClassByDiscriminator(
classByDiscriminatorValue,
getDiscriminatorValue(readElement, ""));
getDiscriminatorValue(readElement, "className"));
}
})
;
GsonBuilder builder = fireBuilder.createGsonBuilder();
return builder;

View File

@@ -55,14 +55,15 @@ public class JSON {
@Override
public Class getClassForElement(JsonElement readElement) {
Map classByDiscriminatorValue = new HashMap();
classByDiscriminatorValue.put("Cat".toUpperCase(), Cat.class);
classByDiscriminatorValue.put("Dog".toUpperCase(), Dog.class);
classByDiscriminatorValue.put("Cat".toUpperCase(), Cat.class);
classByDiscriminatorValue.put("Animal".toUpperCase(), Animal.class);
return getClassByDiscriminator(
classByDiscriminatorValue,
getDiscriminatorValue(readElement, ""));
getDiscriminatorValue(readElement, "className"));
}
})
;
GsonBuilder builder = fireBuilder.createGsonBuilder();
return builder;

View File

@@ -26,7 +26,8 @@ import io.swagger.annotations.ApiModelProperty;
/**
* Animal
*/
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true )
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true)
@JsonSubTypes({
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),

View File

@@ -28,7 +28,8 @@ import javax.xml.bind.annotation.*;
/**
* Animal
*/
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true )
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true)
@JsonSubTypes({
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),

View File

@@ -26,7 +26,8 @@ import io.swagger.annotations.ApiModelProperty;
/**
* Animal
*/
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true )
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true)
@JsonSubTypes({
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),

View File

@@ -28,7 +28,8 @@ import javax.validation.Valid;
/**
* Animal
*/
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true )
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true)
@JsonSubTypes({
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),

View File

@@ -28,7 +28,8 @@ import javax.validation.Valid;
/**
* Animal
*/
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true )
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true)
@JsonSubTypes({
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),

View File

@@ -52,14 +52,15 @@ public class JSON {
@Override
public Class getClassForElement(JsonElement readElement) {
Map classByDiscriminatorValue = new HashMap();
classByDiscriminatorValue.put("Cat".toUpperCase(), Cat.class);
classByDiscriminatorValue.put("Dog".toUpperCase(), Dog.class);
classByDiscriminatorValue.put("Cat".toUpperCase(), Cat.class);
classByDiscriminatorValue.put("Animal".toUpperCase(), Animal.class);
return getClassByDiscriminator(
classByDiscriminatorValue,
getDiscriminatorValue(readElement, ""));
getDiscriminatorValue(readElement, "className"));
}
})
;
return fireBuilder.createGsonBuilder();
}

View File

@@ -52,14 +52,15 @@ public class JSON {
@Override
public Class getClassForElement(JsonElement readElement) {
Map classByDiscriminatorValue = new HashMap();
classByDiscriminatorValue.put("Cat".toUpperCase(), Cat.class);
classByDiscriminatorValue.put("Dog".toUpperCase(), Dog.class);
classByDiscriminatorValue.put("Cat".toUpperCase(), Cat.class);
classByDiscriminatorValue.put("Animal".toUpperCase(), Animal.class);
return getClassByDiscriminator(
classByDiscriminatorValue,
getDiscriminatorValue(readElement, ""));
getDiscriminatorValue(readElement, "className"));
}
})
;
return fireBuilder.createGsonBuilder();
}

View File

@@ -52,14 +52,15 @@ public class JSON {
@Override
public Class getClassForElement(JsonElement readElement) {
Map classByDiscriminatorValue = new HashMap();
classByDiscriminatorValue.put("Cat".toUpperCase(), Cat.class);
classByDiscriminatorValue.put("Dog".toUpperCase(), Dog.class);
classByDiscriminatorValue.put("Cat".toUpperCase(), Cat.class);
classByDiscriminatorValue.put("Animal".toUpperCase(), Animal.class);
return getClassByDiscriminator(
classByDiscriminatorValue,
getDiscriminatorValue(readElement, ""));
getDiscriminatorValue(readElement, "className"));
}
})
;
return fireBuilder.createGsonBuilder();
}

View File

@@ -26,7 +26,8 @@ import io.swagger.annotations.ApiModelProperty;
/**
* Animal
*/
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true )
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true)
@JsonSubTypes({
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),

View File

@@ -26,7 +26,8 @@ import io.swagger.annotations.ApiModelProperty;
/**
* Animal
*/
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true )
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true)
@JsonSubTypes({
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),