forked from loafle/openapi-generator-original
[Java] fix default value for JsonNullable (#14703)
* fix java webclient default value * update default value in java okhttp client * fix java native client default value in JsonNullable * improve java okhttp-gson default value template * update java rest-related templates * update feign samples * update jersey3 templates * update jersey2 templates * update default value in jaxrs templates * fix spring default value * update jaxrs pojo, fix tests * update samples * suport set
This commit is contained in:
@@ -53,11 +53,11 @@ import org.openapitools.client.JSON;
|
||||
public class AdditionalPropertiesClass {
|
||||
public static final String SERIALIZED_NAME_MAP_PROPERTY = "map_property";
|
||||
@SerializedName(SERIALIZED_NAME_MAP_PROPERTY)
|
||||
private Map<String, String> mapProperty = null;
|
||||
private Map<String, String> mapProperty = new HashMap<>();
|
||||
|
||||
public static final String SERIALIZED_NAME_MAP_OF_MAP_PROPERTY = "map_of_map_property";
|
||||
@SerializedName(SERIALIZED_NAME_MAP_OF_MAP_PROPERTY)
|
||||
private Map<String, Map<String, String>> mapOfMapProperty = null;
|
||||
private Map<String, Map<String, String>> mapOfMapProperty = new HashMap<>();
|
||||
|
||||
public static final String SERIALIZED_NAME_ANYTYPE1 = "anytype_1";
|
||||
@SerializedName(SERIALIZED_NAME_ANYTYPE1)
|
||||
@@ -73,7 +73,7 @@ public class AdditionalPropertiesClass {
|
||||
|
||||
public static final String SERIALIZED_NAME_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE3 = "map_with_undeclared_properties_anytype_3";
|
||||
@SerializedName(SERIALIZED_NAME_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE3)
|
||||
private Map<String, Object> mapWithUndeclaredPropertiesAnytype3 = null;
|
||||
private Map<String, Object> mapWithUndeclaredPropertiesAnytype3 = new HashMap<>();
|
||||
|
||||
public static final String SERIALIZED_NAME_EMPTY_MAP = "empty_map";
|
||||
@SerializedName(SERIALIZED_NAME_EMPTY_MAP)
|
||||
@@ -81,7 +81,7 @@ public class AdditionalPropertiesClass {
|
||||
|
||||
public static final String SERIALIZED_NAME_MAP_WITH_UNDECLARED_PROPERTIES_STRING = "map_with_undeclared_properties_string";
|
||||
@SerializedName(SERIALIZED_NAME_MAP_WITH_UNDECLARED_PROPERTIES_STRING)
|
||||
private Map<String, String> mapWithUndeclaredPropertiesString = null;
|
||||
private Map<String, String> mapWithUndeclaredPropertiesString = new HashMap<>();
|
||||
|
||||
public AdditionalPropertiesClass() {
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ import org.openapitools.client.JSON;
|
||||
public class ArrayOfArrayOfNumberOnly {
|
||||
public static final String SERIALIZED_NAME_ARRAY_ARRAY_NUMBER = "ArrayArrayNumber";
|
||||
@SerializedName(SERIALIZED_NAME_ARRAY_ARRAY_NUMBER)
|
||||
private List<List<BigDecimal>> arrayArrayNumber = null;
|
||||
private List<List<BigDecimal>> arrayArrayNumber = new ArrayList<>();
|
||||
|
||||
public ArrayOfArrayOfNumberOnly() {
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ public class ArrayOfInlineAllOf {
|
||||
|
||||
public static final String SERIALIZED_NAME_ARRAY_ALLOF_DOG_PROPERTY = "array_allof_dog_property";
|
||||
@SerializedName(SERIALIZED_NAME_ARRAY_ALLOF_DOG_PROPERTY)
|
||||
private List<ArrayOfInlineAllOfArrayAllofDogPropertyInner> arrayAllofDogProperty = null;
|
||||
private List<ArrayOfInlineAllOfArrayAllofDogPropertyInner> arrayAllofDogProperty = new ArrayList<>();
|
||||
|
||||
public ArrayOfInlineAllOf() {
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ import org.openapitools.client.JSON;
|
||||
public class ArrayOfNumberOnly {
|
||||
public static final String SERIALIZED_NAME_ARRAY_NUMBER = "ArrayNumber";
|
||||
@SerializedName(SERIALIZED_NAME_ARRAY_NUMBER)
|
||||
private List<BigDecimal> arrayNumber = null;
|
||||
private List<BigDecimal> arrayNumber = new ArrayList<>();
|
||||
|
||||
public ArrayOfNumberOnly() {
|
||||
}
|
||||
|
||||
@@ -53,15 +53,15 @@ import org.openapitools.client.JSON;
|
||||
public class ArrayTest {
|
||||
public static final String SERIALIZED_NAME_ARRAY_OF_STRING = "array_of_string";
|
||||
@SerializedName(SERIALIZED_NAME_ARRAY_OF_STRING)
|
||||
private List<String> arrayOfString = null;
|
||||
private List<String> arrayOfString = new ArrayList<>();
|
||||
|
||||
public static final String SERIALIZED_NAME_ARRAY_ARRAY_OF_INTEGER = "array_array_of_integer";
|
||||
@SerializedName(SERIALIZED_NAME_ARRAY_ARRAY_OF_INTEGER)
|
||||
private List<List<Long>> arrayArrayOfInteger = null;
|
||||
private List<List<Long>> arrayArrayOfInteger = new ArrayList<>();
|
||||
|
||||
public static final String SERIALIZED_NAME_ARRAY_ARRAY_OF_MODEL = "array_array_of_model";
|
||||
@SerializedName(SERIALIZED_NAME_ARRAY_ARRAY_OF_MODEL)
|
||||
private List<List<ReadOnlyFirst>> arrayArrayOfModel = null;
|
||||
private List<List<ReadOnlyFirst>> arrayArrayOfModel = new ArrayList<>();
|
||||
|
||||
public ArrayTest() {
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ public class Drawing {
|
||||
|
||||
public static final String SERIALIZED_NAME_SHAPES = "shapes";
|
||||
@SerializedName(SERIALIZED_NAME_SHAPES)
|
||||
private List<Shape> shapes = null;
|
||||
private List<Shape> shapes = new ArrayList<>();
|
||||
|
||||
public Drawing() {
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ public class EnumArrays {
|
||||
|
||||
public static final String SERIALIZED_NAME_ARRAY_ENUM = "array_enum";
|
||||
@SerializedName(SERIALIZED_NAME_ARRAY_ENUM)
|
||||
private List<ArrayEnumEnum> arrayEnum = null;
|
||||
private List<ArrayEnumEnum> arrayEnum = new ArrayList<>();
|
||||
|
||||
public EnumArrays() {
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ public class FileSchemaTestClass {
|
||||
|
||||
public static final String SERIALIZED_NAME_FILES = "files";
|
||||
@SerializedName(SERIALIZED_NAME_FILES)
|
||||
private List<ModelFile> files = null;
|
||||
private List<ModelFile> files = new ArrayList<>();
|
||||
|
||||
public FileSchemaTestClass() {
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ import org.openapitools.client.JSON;
|
||||
public class MapTest {
|
||||
public static final String SERIALIZED_NAME_MAP_MAP_OF_STRING = "map_map_of_string";
|
||||
@SerializedName(SERIALIZED_NAME_MAP_MAP_OF_STRING)
|
||||
private Map<String, Map<String, String>> mapMapOfString = null;
|
||||
private Map<String, Map<String, String>> mapMapOfString = new HashMap<>();
|
||||
|
||||
/**
|
||||
* Gets or Sets inner
|
||||
@@ -103,15 +103,15 @@ public class MapTest {
|
||||
|
||||
public static final String SERIALIZED_NAME_MAP_OF_ENUM_STRING = "map_of_enum_string";
|
||||
@SerializedName(SERIALIZED_NAME_MAP_OF_ENUM_STRING)
|
||||
private Map<String, InnerEnum> mapOfEnumString = null;
|
||||
private Map<String, InnerEnum> mapOfEnumString = new HashMap<>();
|
||||
|
||||
public static final String SERIALIZED_NAME_DIRECT_MAP = "direct_map";
|
||||
@SerializedName(SERIALIZED_NAME_DIRECT_MAP)
|
||||
private Map<String, Boolean> directMap = null;
|
||||
private Map<String, Boolean> directMap = new HashMap<>();
|
||||
|
||||
public static final String SERIALIZED_NAME_INDIRECT_MAP = "indirect_map";
|
||||
@SerializedName(SERIALIZED_NAME_INDIRECT_MAP)
|
||||
private Map<String, Boolean> indirectMap = null;
|
||||
private Map<String, Boolean> indirectMap = new HashMap<>();
|
||||
|
||||
public MapTest() {
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass {
|
||||
|
||||
public static final String SERIALIZED_NAME_MAP = "map";
|
||||
@SerializedName(SERIALIZED_NAME_MAP)
|
||||
private Map<String, Animal> map = null;
|
||||
private Map<String, Animal> map = new HashMap<>();
|
||||
|
||||
public MixedPropertiesAndAdditionalPropertiesClass() {
|
||||
}
|
||||
|
||||
@@ -82,27 +82,27 @@ public class NullableClass {
|
||||
|
||||
public static final String SERIALIZED_NAME_ARRAY_NULLABLE_PROP = "array_nullable_prop";
|
||||
@SerializedName(SERIALIZED_NAME_ARRAY_NULLABLE_PROP)
|
||||
private List<Object> arrayNullableProp = null;
|
||||
private List<Object> arrayNullableProp;
|
||||
|
||||
public static final String SERIALIZED_NAME_ARRAY_AND_ITEMS_NULLABLE_PROP = "array_and_items_nullable_prop";
|
||||
@SerializedName(SERIALIZED_NAME_ARRAY_AND_ITEMS_NULLABLE_PROP)
|
||||
private List<Object> arrayAndItemsNullableProp = null;
|
||||
private List<Object> arrayAndItemsNullableProp;
|
||||
|
||||
public static final String SERIALIZED_NAME_ARRAY_ITEMS_NULLABLE = "array_items_nullable";
|
||||
@SerializedName(SERIALIZED_NAME_ARRAY_ITEMS_NULLABLE)
|
||||
private List<Object> arrayItemsNullable = null;
|
||||
private List<Object> arrayItemsNullable = new ArrayList<>();
|
||||
|
||||
public static final String SERIALIZED_NAME_OBJECT_NULLABLE_PROP = "object_nullable_prop";
|
||||
@SerializedName(SERIALIZED_NAME_OBJECT_NULLABLE_PROP)
|
||||
private Map<String, Object> objectNullableProp = null;
|
||||
private Map<String, Object> objectNullableProp;
|
||||
|
||||
public static final String SERIALIZED_NAME_OBJECT_AND_ITEMS_NULLABLE_PROP = "object_and_items_nullable_prop";
|
||||
@SerializedName(SERIALIZED_NAME_OBJECT_AND_ITEMS_NULLABLE_PROP)
|
||||
private Map<String, Object> objectAndItemsNullableProp = null;
|
||||
private Map<String, Object> objectAndItemsNullableProp;
|
||||
|
||||
public static final String SERIALIZED_NAME_OBJECT_ITEMS_NULLABLE = "object_items_nullable";
|
||||
@SerializedName(SERIALIZED_NAME_OBJECT_ITEMS_NULLABLE)
|
||||
private Map<String, Object> objectItemsNullable = null;
|
||||
private Map<String, Object> objectItemsNullable = new HashMap<>();
|
||||
|
||||
public NullableClass() {
|
||||
}
|
||||
@@ -246,9 +246,6 @@ public class NullableClass {
|
||||
}
|
||||
|
||||
public NullableClass addArrayNullablePropItem(Object arrayNullablePropItem) {
|
||||
if (this.arrayNullableProp == null) {
|
||||
this.arrayNullableProp = null;
|
||||
}
|
||||
this.arrayNullableProp.add(arrayNullablePropItem);
|
||||
return this;
|
||||
}
|
||||
@@ -276,9 +273,6 @@ public class NullableClass {
|
||||
}
|
||||
|
||||
public NullableClass addArrayAndItemsNullablePropItem(Object arrayAndItemsNullablePropItem) {
|
||||
if (this.arrayAndItemsNullableProp == null) {
|
||||
this.arrayAndItemsNullableProp = null;
|
||||
}
|
||||
this.arrayAndItemsNullableProp.add(arrayAndItemsNullablePropItem);
|
||||
return this;
|
||||
}
|
||||
@@ -336,9 +330,6 @@ public class NullableClass {
|
||||
}
|
||||
|
||||
public NullableClass putObjectNullablePropItem(String key, Object objectNullablePropItem) {
|
||||
if (this.objectNullableProp == null) {
|
||||
this.objectNullableProp = null;
|
||||
}
|
||||
this.objectNullableProp.put(key, objectNullablePropItem);
|
||||
return this;
|
||||
}
|
||||
@@ -366,9 +357,6 @@ public class NullableClass {
|
||||
}
|
||||
|
||||
public NullableClass putObjectAndItemsNullablePropItem(String key, Object objectAndItemsNullablePropItem) {
|
||||
if (this.objectAndItemsNullableProp == null) {
|
||||
this.objectAndItemsNullableProp = null;
|
||||
}
|
||||
this.objectAndItemsNullableProp.put(key, objectAndItemsNullablePropItem);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ public class ObjectWithDeprecatedFields {
|
||||
|
||||
public static final String SERIALIZED_NAME_BARS = "bars";
|
||||
@SerializedName(SERIALIZED_NAME_BARS)
|
||||
private List<String> bars = null;
|
||||
private List<String> bars = new ArrayList<>();
|
||||
|
||||
public ObjectWithDeprecatedFields() {
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ public class Pet {
|
||||
|
||||
public static final String SERIALIZED_NAME_TAGS = "tags";
|
||||
@SerializedName(SERIALIZED_NAME_TAGS)
|
||||
private List<Tag> tags = null;
|
||||
private List<Tag> tags = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* pet status in the store
|
||||
|
||||
Reference in New Issue
Block a user