forked from loafle/openapi-generator-original
[Java][okhttp-gson] fix failure to deserialize floats (#3846)
* fixed bug where nullApi.java would be generated. Instead, generated DefaultApi.java to match the default path /{pathParam}
* fix to bug #3157
* update samples
This commit is contained in:
committed by
William Cheng
parent
5fd15b8b18
commit
239d68df36
@@ -72,7 +72,7 @@ public class EnumArrays {
|
||||
|
||||
@Override
|
||||
public JustSymbolEnum read(final JsonReader jsonReader) throws IOException {
|
||||
String value = jsonReader.nextString();
|
||||
String value = jsonReader.nextString();
|
||||
return JustSymbolEnum.fromValue(value);
|
||||
}
|
||||
}
|
||||
@@ -123,7 +123,7 @@ public class EnumArrays {
|
||||
|
||||
@Override
|
||||
public ArrayEnumEnum read(final JsonReader jsonReader) throws IOException {
|
||||
String value = jsonReader.nextString();
|
||||
String value = jsonReader.nextString();
|
||||
return ArrayEnumEnum.fromValue(value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ public class EnumTest {
|
||||
|
||||
@Override
|
||||
public EnumStringEnum read(final JsonReader jsonReader) throws IOException {
|
||||
String value = jsonReader.nextString();
|
||||
String value = jsonReader.nextString();
|
||||
return EnumStringEnum.fromValue(value);
|
||||
}
|
||||
}
|
||||
@@ -126,7 +126,7 @@ public class EnumTest {
|
||||
|
||||
@Override
|
||||
public EnumStringRequiredEnum read(final JsonReader jsonReader) throws IOException {
|
||||
String value = jsonReader.nextString();
|
||||
String value = jsonReader.nextString();
|
||||
return EnumStringRequiredEnum.fromValue(value);
|
||||
}
|
||||
}
|
||||
@@ -177,7 +177,7 @@ public class EnumTest {
|
||||
|
||||
@Override
|
||||
public EnumIntegerEnum read(final JsonReader jsonReader) throws IOException {
|
||||
Integer value = jsonReader.nextInt();
|
||||
Integer value = jsonReader.nextInt();
|
||||
return EnumIntegerEnum.fromValue(value);
|
||||
}
|
||||
}
|
||||
@@ -228,7 +228,7 @@ public class EnumTest {
|
||||
|
||||
@Override
|
||||
public EnumNumberEnum read(final JsonReader jsonReader) throws IOException {
|
||||
Double value = jsonReader.nextDouble();
|
||||
Double value = jsonReader.nextDouble();
|
||||
return EnumNumberEnum.fromValue(value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ public class MapTest {
|
||||
|
||||
@Override
|
||||
public InnerEnum read(final JsonReader jsonReader) throws IOException {
|
||||
String value = jsonReader.nextString();
|
||||
String value = jsonReader.nextString();
|
||||
return InnerEnum.fromValue(value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ public class Order {
|
||||
|
||||
@Override
|
||||
public StatusEnum read(final JsonReader jsonReader) throws IOException {
|
||||
String value = jsonReader.nextString();
|
||||
String value = jsonReader.nextString();
|
||||
return StatusEnum.fromValue(value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ public class Pet {
|
||||
|
||||
@Override
|
||||
public StatusEnum read(final JsonReader jsonReader) throws IOException {
|
||||
String value = jsonReader.nextString();
|
||||
String value = jsonReader.nextString();
|
||||
return StatusEnum.fromValue(value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,6 +40,10 @@ public class TypeHolderExample {
|
||||
@SerializedName(SERIALIZED_NAME_NUMBER_ITEM)
|
||||
private BigDecimal numberItem;
|
||||
|
||||
public static final String SERIALIZED_NAME_FLOAT_ITEM = "float_item";
|
||||
@SerializedName(SERIALIZED_NAME_FLOAT_ITEM)
|
||||
private Float floatItem;
|
||||
|
||||
public static final String SERIALIZED_NAME_INTEGER_ITEM = "integer_item";
|
||||
@SerializedName(SERIALIZED_NAME_INTEGER_ITEM)
|
||||
private Integer integerItem;
|
||||
@@ -99,6 +103,29 @@ public class TypeHolderExample {
|
||||
}
|
||||
|
||||
|
||||
public TypeHolderExample floatItem(Float floatItem) {
|
||||
|
||||
this.floatItem = floatItem;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get floatItem
|
||||
* @return floatItem
|
||||
**/
|
||||
@ApiModelProperty(example = "1.234", required = true, value = "")
|
||||
|
||||
public Float getFloatItem() {
|
||||
return floatItem;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setFloatItem(Float floatItem) {
|
||||
this.floatItem = floatItem;
|
||||
}
|
||||
|
||||
|
||||
public TypeHolderExample integerItem(Integer integerItem) {
|
||||
|
||||
this.integerItem = integerItem;
|
||||
@@ -184,6 +211,7 @@ public class TypeHolderExample {
|
||||
TypeHolderExample typeHolderExample = (TypeHolderExample) o;
|
||||
return Objects.equals(this.stringItem, typeHolderExample.stringItem) &&
|
||||
Objects.equals(this.numberItem, typeHolderExample.numberItem) &&
|
||||
Objects.equals(this.floatItem, typeHolderExample.floatItem) &&
|
||||
Objects.equals(this.integerItem, typeHolderExample.integerItem) &&
|
||||
Objects.equals(this.boolItem, typeHolderExample.boolItem) &&
|
||||
Objects.equals(this.arrayItem, typeHolderExample.arrayItem);
|
||||
@@ -191,7 +219,7 @@ public class TypeHolderExample {
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(stringItem, numberItem, integerItem, boolItem, arrayItem);
|
||||
return Objects.hash(stringItem, numberItem, floatItem, integerItem, boolItem, arrayItem);
|
||||
}
|
||||
|
||||
|
||||
@@ -201,6 +229,7 @@ public class TypeHolderExample {
|
||||
sb.append("class TypeHolderExample {\n");
|
||||
sb.append(" stringItem: ").append(toIndentedString(stringItem)).append("\n");
|
||||
sb.append(" numberItem: ").append(toIndentedString(numberItem)).append("\n");
|
||||
sb.append(" floatItem: ").append(toIndentedString(floatItem)).append("\n");
|
||||
sb.append(" integerItem: ").append(toIndentedString(integerItem)).append("\n");
|
||||
sb.append(" boolItem: ").append(toIndentedString(boolItem)).append("\n");
|
||||
sb.append(" arrayItem: ").append(toIndentedString(arrayItem)).append("\n");
|
||||
|
||||
Reference in New Issue
Block a user