[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:
William Cheng
2023-03-17 11:58:49 +08:00
committed by GitHub
parent d0f7bd18ba
commit 3d4f7b3ce0
622 changed files with 3440 additions and 1173 deletions

View File

@@ -36,7 +36,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() {
}

View File

@@ -36,7 +36,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() {
}

View File

@@ -38,13 +38,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() {
}

View File

@@ -109,7 +109,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() {
}

View File

@@ -40,7 +40,7 @@ public class FileSchemaTestClass {
private File file;
public static final String JSON_PROPERTY_FILES = "files";
private List<File> files = new ArrayList<>();
private List<File> files;
public FileSchemaTestClass() {
}

View File

@@ -57,7 +57,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
@@ -187,6 +187,9 @@ public class Pet {
}
public Pet addPhotoUrlsItem(String photoUrlsItem) {
if (this.photoUrls == null) {
this.photoUrls = new LinkedHashSet<>();
}
this.photoUrls.add(photoUrlsItem);
return this;
}

View File

@@ -168,6 +168,9 @@ public class TypeHolderDefault {
}
public TypeHolderDefault addArrayItemItem(Integer arrayItemItem) {
if (this.arrayItem == null) {
this.arrayItem = new ArrayList<>();
}
this.arrayItem.add(arrayItemItem);
return this;
}

View File

@@ -198,6 +198,9 @@ public class TypeHolderExample {
}
public TypeHolderExample addArrayItemItem(Integer arrayItemItem) {
if (this.arrayItem == null) {
this.arrayItem = new ArrayList<>();
}
this.arrayItem.add(arrayItemItem);
return this;
}

View File

@@ -76,7 +76,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;
@@ -91,10 +91,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;
@@ -109,10 +109,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;
@@ -127,10 +127,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;
@@ -145,10 +145,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() {
}