Fix default empty collections when collection is optional (#18080)

* Fix optional empty collection as default

* Fix test

* Fix test
This commit is contained in:
Dennis Melzer
2024-03-14 13:28:27 +01:00
committed by GitHub
parent 6075b8a8f1
commit 96bf7ac915
495 changed files with 1548 additions and 1481 deletions

View File

@@ -47,7 +47,7 @@ public class ArrayOfArrayOfNumberOnly {
// items.name=arrayArrayNumber items.baseName=arrayArrayNumber items.xmlName= items.xmlNamespace=
// items.example= items.type=List<BigDecimal>
@XmlElement(name = "arrayArrayNumber")
private List<List<BigDecimal>> arrayArrayNumber;
private List<List<BigDecimal>> arrayArrayNumber = new ArrayList<>();
public ArrayOfArrayOfNumberOnly() {
}

View File

@@ -47,7 +47,7 @@ public class ArrayOfNumberOnly {
// items.name=arrayNumber items.baseName=arrayNumber items.xmlName= items.xmlNamespace=
// items.example= items.type=BigDecimal
@XmlElement(name = "arrayNumber")
private List<BigDecimal> arrayNumber;
private List<BigDecimal> arrayNumber = new ArrayList<>();
public ArrayOfNumberOnly() {
}

View File

@@ -49,21 +49,21 @@ public class ArrayTest {
// items.name=arrayOfString items.baseName=arrayOfString items.xmlName= items.xmlNamespace=
// items.example= items.type=String
@XmlElement(name = "arrayOfString")
private List<String> arrayOfString;
private List<String> arrayOfString = new ArrayList<>();
public static final String JSON_PROPERTY_ARRAY_ARRAY_OF_INTEGER = "array_array_of_integer";
// Is a container wrapped=false
// items.name=arrayArrayOfInteger items.baseName=arrayArrayOfInteger items.xmlName= items.xmlNamespace=
// items.example= items.type=List&lt;Long&gt;
@XmlElement(name = "arrayArrayOfInteger")
private List<List<Long>> arrayArrayOfInteger;
private List<List<Long>> arrayArrayOfInteger = new ArrayList<>();
public static final String JSON_PROPERTY_ARRAY_ARRAY_OF_MODEL = "array_array_of_model";
// Is a container wrapped=false
// items.name=arrayArrayOfModel items.baseName=arrayArrayOfModel items.xmlName= items.xmlNamespace=
// items.example= items.type=List&lt;ReadOnlyFirst&gt;
@XmlElement(name = "arrayArrayOfModel")
private List<List<ReadOnlyFirst>> arrayArrayOfModel;
private List<List<ReadOnlyFirst>> arrayArrayOfModel = new ArrayList<>();
public ArrayTest() {
}

View File

@@ -129,7 +129,7 @@ public class EnumArrays {
// items.name=arrayEnum items.baseName=arrayEnum items.xmlName= items.xmlNamespace=
// items.example= items.type=String
@XmlElement(name = "arrayEnum")
private List<ArrayEnumEnum> arrayEnum;
private List<ArrayEnumEnum> arrayEnum = new ArrayList<>();
public EnumArrays() {
}

View File

@@ -52,7 +52,7 @@ public class FileSchemaTestClass {
// items.name=files items.baseName=files items.xmlName= items.xmlNamespace=
// items.example= items.type=ModelFile
@XmlElement(name = "files")
private List<ModelFile> files;
private List<ModelFile> files = new ArrayList<>();
public FileSchemaTestClass() {
}

View File

@@ -105,7 +105,7 @@ public class NullableClass extends HashMap<String, Object> {
// items.name=arrayItemsNullable items.baseName=arrayItemsNullable items.xmlName= items.xmlNamespace=
// items.example= items.type=Object
@XmlElement(name = "arrayItemsNullable")
private List<Object> arrayItemsNullable;
private List<Object> arrayItemsNullable = new ArrayList<>();
public static final String JSON_PROPERTY_OBJECT_NULLABLE_PROP = "object_nullable_prop";
// Is a container wrapped=false

View File

@@ -63,7 +63,7 @@ public class ObjectWithDeprecatedFields {
// items.name=bars items.baseName=bars items.xmlName= items.xmlNamespace=
// items.example= items.type=String
@XmlElement(name = "bars")
private List<String> bars;
private List<String> bars = new ArrayList<>();
public ObjectWithDeprecatedFields() {
}

View File

@@ -77,7 +77,7 @@ public class Pet {
// items.example= items.type=Tag
@XmlElement(name = "Tag")
@XmlElementWrapper(name = "tag")
private List<Tag> tags;
private List<Tag> tags = new ArrayList<>();
/**
* pet status in the store