mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-09 13:46:10 +00:00
[java] fix optional array property's default value (#14961)
* fix optional array property default value * fix default values * more fixes * update default value for jersey2, 3, okhttp-gson * update default value * fix java okhttp-gson * fix jersey2, 3
This commit is contained in:
@@ -35,7 +35,7 @@ import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
|
||||
public class ArrayOfArrayOfNumberOnly {
|
||||
public static final String JSON_PROPERTY_ARRAY_ARRAY_NUMBER = "ArrayArrayNumber";
|
||||
private List<List<BigDecimal>> arrayArrayNumber = new ArrayList<>();
|
||||
private List<List<BigDecimal>> arrayArrayNumber;
|
||||
|
||||
public ArrayOfArrayOfNumberOnly() {
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
|
||||
public class ArrayOfNumberOnly {
|
||||
public static final String JSON_PROPERTY_ARRAY_NUMBER = "ArrayNumber";
|
||||
private List<BigDecimal> arrayNumber = new ArrayList<>();
|
||||
private List<BigDecimal> arrayNumber;
|
||||
|
||||
public ArrayOfNumberOnly() {
|
||||
}
|
||||
|
||||
@@ -37,13 +37,13 @@ import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
|
||||
public class ArrayTest {
|
||||
public static final String JSON_PROPERTY_ARRAY_OF_STRING = "array_of_string";
|
||||
private List<String> arrayOfString = new ArrayList<>();
|
||||
private List<String> arrayOfString;
|
||||
|
||||
public static final String JSON_PROPERTY_ARRAY_ARRAY_OF_INTEGER = "array_array_of_integer";
|
||||
private List<List<Long>> arrayArrayOfInteger = new ArrayList<>();
|
||||
private List<List<Long>> arrayArrayOfInteger;
|
||||
|
||||
public static final String JSON_PROPERTY_ARRAY_ARRAY_OF_MODEL = "array_array_of_model";
|
||||
private List<List<ReadOnlyFirst>> arrayArrayOfModel = new ArrayList<>();
|
||||
private List<List<ReadOnlyFirst>> arrayArrayOfModel;
|
||||
|
||||
public ArrayTest() {
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ public class EnumArrays {
|
||||
}
|
||||
|
||||
public static final String JSON_PROPERTY_ARRAY_ENUM = "array_enum";
|
||||
private List<ArrayEnumEnum> arrayEnum = new ArrayList<>();
|
||||
private List<ArrayEnumEnum> arrayEnum;
|
||||
|
||||
public EnumArrays() {
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ public class FileSchemaTestClass {
|
||||
private ModelFile _file;
|
||||
|
||||
public static final String JSON_PROPERTY_FILES = "files";
|
||||
private List<ModelFile> files = new ArrayList<>();
|
||||
private List<ModelFile> files;
|
||||
|
||||
public FileSchemaTestClass() {
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ public class Pet {
|
||||
private Set<String> photoUrls = new LinkedHashSet<>();
|
||||
|
||||
public static final String JSON_PROPERTY_TAGS = "tags";
|
||||
private List<Tag> tags = new ArrayList<>();
|
||||
private List<Tag> tags;
|
||||
|
||||
/**
|
||||
* pet status in the store
|
||||
@@ -186,6 +186,9 @@ public class Pet {
|
||||
}
|
||||
|
||||
public Pet addPhotoUrlsItem(String photoUrlsItem) {
|
||||
if (this.photoUrls == null) {
|
||||
this.photoUrls = new LinkedHashSet<>();
|
||||
}
|
||||
this.photoUrls.add(photoUrlsItem);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -167,6 +167,9 @@ public class TypeHolderDefault {
|
||||
}
|
||||
|
||||
public TypeHolderDefault addArrayItemItem(Integer arrayItemItem) {
|
||||
if (this.arrayItem == null) {
|
||||
this.arrayItem = new ArrayList<>();
|
||||
}
|
||||
this.arrayItem.add(arrayItemItem);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -197,6 +197,9 @@ public class TypeHolderExample {
|
||||
}
|
||||
|
||||
public TypeHolderExample addArrayItemItem(Integer arrayItemItem) {
|
||||
if (this.arrayItem == null) {
|
||||
this.arrayItem = new ArrayList<>();
|
||||
}
|
||||
this.arrayItem.add(arrayItemItem);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ public class XmlItem {
|
||||
private Boolean attributeBoolean;
|
||||
|
||||
public static final String JSON_PROPERTY_WRAPPED_ARRAY = "wrapped_array";
|
||||
private List<Integer> wrappedArray = new ArrayList<>();
|
||||
private List<Integer> wrappedArray;
|
||||
|
||||
public static final String JSON_PROPERTY_NAME_STRING = "name_string";
|
||||
private String nameString;
|
||||
@@ -90,10 +90,10 @@ public class XmlItem {
|
||||
private Boolean nameBoolean;
|
||||
|
||||
public static final String JSON_PROPERTY_NAME_ARRAY = "name_array";
|
||||
private List<Integer> nameArray = new ArrayList<>();
|
||||
private List<Integer> nameArray;
|
||||
|
||||
public static final String JSON_PROPERTY_NAME_WRAPPED_ARRAY = "name_wrapped_array";
|
||||
private List<Integer> nameWrappedArray = new ArrayList<>();
|
||||
private List<Integer> nameWrappedArray;
|
||||
|
||||
public static final String JSON_PROPERTY_PREFIX_STRING = "prefix_string";
|
||||
private String prefixString;
|
||||
@@ -108,10 +108,10 @@ public class XmlItem {
|
||||
private Boolean prefixBoolean;
|
||||
|
||||
public static final String JSON_PROPERTY_PREFIX_ARRAY = "prefix_array";
|
||||
private List<Integer> prefixArray = new ArrayList<>();
|
||||
private List<Integer> prefixArray;
|
||||
|
||||
public static final String JSON_PROPERTY_PREFIX_WRAPPED_ARRAY = "prefix_wrapped_array";
|
||||
private List<Integer> prefixWrappedArray = new ArrayList<>();
|
||||
private List<Integer> prefixWrappedArray;
|
||||
|
||||
public static final String JSON_PROPERTY_NAMESPACE_STRING = "namespace_string";
|
||||
private String namespaceString;
|
||||
@@ -126,10 +126,10 @@ public class XmlItem {
|
||||
private Boolean namespaceBoolean;
|
||||
|
||||
public static final String JSON_PROPERTY_NAMESPACE_ARRAY = "namespace_array";
|
||||
private List<Integer> namespaceArray = new ArrayList<>();
|
||||
private List<Integer> namespaceArray;
|
||||
|
||||
public static final String JSON_PROPERTY_NAMESPACE_WRAPPED_ARRAY = "namespace_wrapped_array";
|
||||
private List<Integer> namespaceWrappedArray = new ArrayList<>();
|
||||
private List<Integer> namespaceWrappedArray;
|
||||
|
||||
public static final String JSON_PROPERTY_PREFIX_NS_STRING = "prefix_ns_string";
|
||||
private String prefixNsString;
|
||||
@@ -144,10 +144,10 @@ public class XmlItem {
|
||||
private Boolean prefixNsBoolean;
|
||||
|
||||
public static final String JSON_PROPERTY_PREFIX_NS_ARRAY = "prefix_ns_array";
|
||||
private List<Integer> prefixNsArray = new ArrayList<>();
|
||||
private List<Integer> prefixNsArray;
|
||||
|
||||
public static final String JSON_PROPERTY_PREFIX_NS_WRAPPED_ARRAY = "prefix_ns_wrapped_array";
|
||||
private List<Integer> prefixNsWrappedArray = new ArrayList<>();
|
||||
private List<Integer> prefixNsWrappedArray;
|
||||
|
||||
public XmlItem() {
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user