forked from loafle/openapi-generator-original
#5712 put @JsonValue to appropriate place in generated enum, add TypeAdapter for Gson enums, enhance tests (#5713)
This commit is contained in:
@@ -14,9 +14,14 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -14,9 +14,14 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Animal
|
||||
|
||||
@@ -14,9 +14,14 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -14,9 +14,14 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -14,10 +14,15 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.client.model.ReadOnlyFirst;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -14,9 +14,14 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Capitalization
|
||||
|
||||
@@ -14,10 +14,15 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.client.model.Animal;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Cat
|
||||
|
||||
@@ -14,9 +14,14 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Category
|
||||
|
||||
@@ -14,9 +14,14 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Model for testing model with \"_class\" property
|
||||
|
||||
@@ -14,9 +14,14 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Client
|
||||
|
||||
@@ -14,10 +14,15 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.client.model.Animal;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Dog
|
||||
|
||||
@@ -14,9 +14,14 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -28,11 +33,10 @@ public class EnumArrays {
|
||||
/**
|
||||
* Gets or Sets justSymbol
|
||||
*/
|
||||
@JsonAdapter(JustSymbolEnum.Adapter.class)
|
||||
public enum JustSymbolEnum {
|
||||
@SerializedName(">=")
|
||||
GREATER_THAN_OR_EQUAL_TO(">="),
|
||||
|
||||
@SerializedName("$")
|
||||
DOLLAR("$");
|
||||
|
||||
private String value;
|
||||
@@ -49,6 +53,28 @@ public class EnumArrays {
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
||||
public static JustSymbolEnum fromValue(String text) {
|
||||
for (JustSymbolEnum b : JustSymbolEnum.values()) {
|
||||
if (String.valueOf(b.value).equals(text)) {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static class Adapter extends TypeAdapter<JustSymbolEnum> {
|
||||
@Override
|
||||
public void write(final JsonWriter jsonWriter, final JustSymbolEnum enumeration) throws IOException {
|
||||
jsonWriter.value(enumeration.getValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public JustSymbolEnum read(final JsonReader jsonReader) throws IOException {
|
||||
String value = jsonReader.nextString();
|
||||
return JustSymbolEnum.fromValue(String.valueOf(value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SerializedName("just_symbol")
|
||||
@@ -57,11 +83,10 @@ public class EnumArrays {
|
||||
/**
|
||||
* Gets or Sets arrayEnum
|
||||
*/
|
||||
@JsonAdapter(ArrayEnumEnum.Adapter.class)
|
||||
public enum ArrayEnumEnum {
|
||||
@SerializedName("fish")
|
||||
FISH("fish"),
|
||||
|
||||
@SerializedName("crab")
|
||||
CRAB("crab");
|
||||
|
||||
private String value;
|
||||
@@ -78,6 +103,28 @@ public class EnumArrays {
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
||||
public static ArrayEnumEnum fromValue(String text) {
|
||||
for (ArrayEnumEnum b : ArrayEnumEnum.values()) {
|
||||
if (String.valueOf(b.value).equals(text)) {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static class Adapter extends TypeAdapter<ArrayEnumEnum> {
|
||||
@Override
|
||||
public void write(final JsonWriter jsonWriter, final ArrayEnumEnum enumeration) throws IOException {
|
||||
jsonWriter.value(enumeration.getValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayEnumEnum read(final JsonReader jsonReader) throws IOException {
|
||||
String value = jsonReader.nextString();
|
||||
return ArrayEnumEnum.fromValue(String.valueOf(value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SerializedName("array_enum")
|
||||
|
||||
@@ -16,19 +16,22 @@ package io.swagger.client.model;
|
||||
import java.util.Objects;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.io.IOException;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
|
||||
/**
|
||||
* Gets or Sets EnumClass
|
||||
*/
|
||||
@JsonAdapter(EnumClass.Adapter.class)
|
||||
public enum EnumClass {
|
||||
|
||||
@SerializedName("_abc")
|
||||
_ABC("_abc"),
|
||||
|
||||
@SerializedName("-efg")
|
||||
_EFG("-efg"),
|
||||
|
||||
@SerializedName("(xyz)")
|
||||
_XYZ_("(xyz)");
|
||||
|
||||
private String value;
|
||||
@@ -45,5 +48,27 @@ public enum EnumClass {
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
||||
public static EnumClass fromValue(String text) {
|
||||
for (EnumClass b : EnumClass.values()) {
|
||||
if (String.valueOf(b.value).equals(text)) {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static class Adapter extends TypeAdapter<EnumClass> {
|
||||
@Override
|
||||
public void write(final JsonWriter jsonWriter, final EnumClass enumeration) throws IOException {
|
||||
jsonWriter.value(enumeration.getValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumClass read(final JsonReader jsonReader) throws IOException {
|
||||
String value = jsonReader.nextString();
|
||||
return EnumClass.fromValue(String.valueOf(value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,10 +14,15 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.client.model.OuterEnum;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* EnumTest
|
||||
@@ -27,14 +32,12 @@ public class EnumTest {
|
||||
/**
|
||||
* Gets or Sets enumString
|
||||
*/
|
||||
@JsonAdapter(EnumStringEnum.Adapter.class)
|
||||
public enum EnumStringEnum {
|
||||
@SerializedName("UPPER")
|
||||
UPPER("UPPER"),
|
||||
|
||||
@SerializedName("lower")
|
||||
LOWER("lower"),
|
||||
|
||||
@SerializedName("")
|
||||
EMPTY("");
|
||||
|
||||
private String value;
|
||||
@@ -51,6 +54,28 @@ public class EnumTest {
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
||||
public static EnumStringEnum fromValue(String text) {
|
||||
for (EnumStringEnum b : EnumStringEnum.values()) {
|
||||
if (String.valueOf(b.value).equals(text)) {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static class Adapter extends TypeAdapter<EnumStringEnum> {
|
||||
@Override
|
||||
public void write(final JsonWriter jsonWriter, final EnumStringEnum enumeration) throws IOException {
|
||||
jsonWriter.value(enumeration.getValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumStringEnum read(final JsonReader jsonReader) throws IOException {
|
||||
String value = jsonReader.nextString();
|
||||
return EnumStringEnum.fromValue(String.valueOf(value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SerializedName("enum_string")
|
||||
@@ -59,11 +84,10 @@ public class EnumTest {
|
||||
/**
|
||||
* Gets or Sets enumInteger
|
||||
*/
|
||||
@JsonAdapter(EnumIntegerEnum.Adapter.class)
|
||||
public enum EnumIntegerEnum {
|
||||
@SerializedName("1")
|
||||
NUMBER_1(1),
|
||||
|
||||
@SerializedName("-1")
|
||||
NUMBER_MINUS_1(-1);
|
||||
|
||||
private Integer value;
|
||||
@@ -80,6 +104,28 @@ public class EnumTest {
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
||||
public static EnumIntegerEnum fromValue(String text) {
|
||||
for (EnumIntegerEnum b : EnumIntegerEnum.values()) {
|
||||
if (String.valueOf(b.value).equals(text)) {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static class Adapter extends TypeAdapter<EnumIntegerEnum> {
|
||||
@Override
|
||||
public void write(final JsonWriter jsonWriter, final EnumIntegerEnum enumeration) throws IOException {
|
||||
jsonWriter.value(enumeration.getValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumIntegerEnum read(final JsonReader jsonReader) throws IOException {
|
||||
Integer value = jsonReader.nextInt();
|
||||
return EnumIntegerEnum.fromValue(String.valueOf(value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SerializedName("enum_integer")
|
||||
@@ -88,11 +134,10 @@ public class EnumTest {
|
||||
/**
|
||||
* Gets or Sets enumNumber
|
||||
*/
|
||||
@JsonAdapter(EnumNumberEnum.Adapter.class)
|
||||
public enum EnumNumberEnum {
|
||||
@SerializedName("1.1")
|
||||
NUMBER_1_DOT_1(1.1),
|
||||
|
||||
@SerializedName("-1.2")
|
||||
NUMBER_MINUS_1_DOT_2(-1.2);
|
||||
|
||||
private Double value;
|
||||
@@ -109,6 +154,28 @@ public class EnumTest {
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
||||
public static EnumNumberEnum fromValue(String text) {
|
||||
for (EnumNumberEnum b : EnumNumberEnum.values()) {
|
||||
if (String.valueOf(b.value).equals(text)) {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static class Adapter extends TypeAdapter<EnumNumberEnum> {
|
||||
@Override
|
||||
public void write(final JsonWriter jsonWriter, final EnumNumberEnum enumeration) throws IOException {
|
||||
jsonWriter.value(enumeration.getValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumNumberEnum read(final JsonReader jsonReader) throws IOException {
|
||||
Double value = jsonReader.nextDouble();
|
||||
return EnumNumberEnum.fromValue(String.valueOf(value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SerializedName("enum_number")
|
||||
|
||||
@@ -14,9 +14,14 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.UUID;
|
||||
import org.joda.time.DateTime;
|
||||
|
||||
@@ -14,9 +14,14 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* HasOnlyReadOnly
|
||||
|
||||
@@ -14,9 +14,14 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -32,11 +37,10 @@ public class MapTest {
|
||||
/**
|
||||
* Gets or Sets inner
|
||||
*/
|
||||
@JsonAdapter(InnerEnum.Adapter.class)
|
||||
public enum InnerEnum {
|
||||
@SerializedName("UPPER")
|
||||
UPPER("UPPER"),
|
||||
|
||||
@SerializedName("lower")
|
||||
LOWER("lower");
|
||||
|
||||
private String value;
|
||||
@@ -53,6 +57,28 @@ public class MapTest {
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
||||
public static InnerEnum fromValue(String text) {
|
||||
for (InnerEnum b : InnerEnum.values()) {
|
||||
if (String.valueOf(b.value).equals(text)) {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static class Adapter extends TypeAdapter<InnerEnum> {
|
||||
@Override
|
||||
public void write(final JsonWriter jsonWriter, final InnerEnum enumeration) throws IOException {
|
||||
jsonWriter.value(enumeration.getValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public InnerEnum read(final JsonReader jsonReader) throws IOException {
|
||||
String value = jsonReader.nextString();
|
||||
return InnerEnum.fromValue(String.valueOf(value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SerializedName("map_of_enum_string")
|
||||
|
||||
@@ -14,10 +14,15 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.client.model.Animal;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -14,9 +14,14 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Model for testing model name starting with number
|
||||
|
||||
@@ -14,9 +14,14 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* ModelApiResponse
|
||||
|
||||
@@ -14,9 +14,14 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Model for testing reserved words
|
||||
|
||||
@@ -14,9 +14,14 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Model for testing model name same as property name
|
||||
|
||||
@@ -14,9 +14,14 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
|
||||
@@ -14,9 +14,14 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.IOException;
|
||||
import org.joda.time.DateTime;
|
||||
|
||||
/**
|
||||
@@ -39,14 +44,12 @@ public class Order {
|
||||
/**
|
||||
* Order Status
|
||||
*/
|
||||
@JsonAdapter(StatusEnum.Adapter.class)
|
||||
public enum StatusEnum {
|
||||
@SerializedName("placed")
|
||||
PLACED("placed"),
|
||||
|
||||
@SerializedName("approved")
|
||||
APPROVED("approved"),
|
||||
|
||||
@SerializedName("delivered")
|
||||
DELIVERED("delivered");
|
||||
|
||||
private String value;
|
||||
@@ -63,6 +66,28 @@ public class Order {
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
||||
public static StatusEnum fromValue(String text) {
|
||||
for (StatusEnum b : StatusEnum.values()) {
|
||||
if (String.valueOf(b.value).equals(text)) {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static class Adapter extends TypeAdapter<StatusEnum> {
|
||||
@Override
|
||||
public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException {
|
||||
jsonWriter.value(enumeration.getValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public StatusEnum read(final JsonReader jsonReader) throws IOException {
|
||||
String value = jsonReader.nextString();
|
||||
return StatusEnum.fromValue(String.valueOf(value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SerializedName("status")
|
||||
|
||||
@@ -14,9 +14,14 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
|
||||
@@ -16,19 +16,22 @@ package io.swagger.client.model;
|
||||
import java.util.Objects;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.io.IOException;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
|
||||
/**
|
||||
* Gets or Sets OuterEnum
|
||||
*/
|
||||
@JsonAdapter(OuterEnum.Adapter.class)
|
||||
public enum OuterEnum {
|
||||
|
||||
@SerializedName("placed")
|
||||
PLACED("placed"),
|
||||
|
||||
@SerializedName("approved")
|
||||
APPROVED("approved"),
|
||||
|
||||
@SerializedName("delivered")
|
||||
DELIVERED("delivered");
|
||||
|
||||
private String value;
|
||||
@@ -45,5 +48,27 @@ public enum OuterEnum {
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
||||
public static OuterEnum fromValue(String text) {
|
||||
for (OuterEnum b : OuterEnum.values()) {
|
||||
if (String.valueOf(b.value).equals(text)) {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static class Adapter extends TypeAdapter<OuterEnum> {
|
||||
@Override
|
||||
public void write(final JsonWriter jsonWriter, final OuterEnum enumeration) throws IOException {
|
||||
jsonWriter.value(enumeration.getValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public OuterEnum read(final JsonReader jsonReader) throws IOException {
|
||||
String value = jsonReader.nextString();
|
||||
return OuterEnum.fromValue(String.valueOf(value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,11 +14,16 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.client.model.Category;
|
||||
import io.swagger.client.model.Tag;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -45,14 +50,12 @@ public class Pet {
|
||||
/**
|
||||
* pet status in the store
|
||||
*/
|
||||
@JsonAdapter(StatusEnum.Adapter.class)
|
||||
public enum StatusEnum {
|
||||
@SerializedName("available")
|
||||
AVAILABLE("available"),
|
||||
|
||||
@SerializedName("pending")
|
||||
PENDING("pending"),
|
||||
|
||||
@SerializedName("sold")
|
||||
SOLD("sold");
|
||||
|
||||
private String value;
|
||||
@@ -69,6 +72,28 @@ public class Pet {
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
||||
public static StatusEnum fromValue(String text) {
|
||||
for (StatusEnum b : StatusEnum.values()) {
|
||||
if (String.valueOf(b.value).equals(text)) {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static class Adapter extends TypeAdapter<StatusEnum> {
|
||||
@Override
|
||||
public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException {
|
||||
jsonWriter.value(enumeration.getValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public StatusEnum read(final JsonReader jsonReader) throws IOException {
|
||||
String value = jsonReader.nextString();
|
||||
return StatusEnum.fromValue(String.valueOf(value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SerializedName("status")
|
||||
|
||||
@@ -14,9 +14,14 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* ReadOnlyFirst
|
||||
|
||||
@@ -14,9 +14,14 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* SpecialModelName
|
||||
|
||||
@@ -14,9 +14,14 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Tag
|
||||
|
||||
@@ -14,9 +14,14 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* User
|
||||
|
||||
Reference in New Issue
Block a user