[spring] fix default value for nullable containers (#14959)

* fix default value, update spec to 3.0

* add tests for container default value

* update java camel samples

* remove samples/openapi3/server/petstore/springboot-beanvalidation-no-nullable

* remove ./bin/configs/spring-boot-beanvalidation-no-nullable-oas3.yaml

* remove samples/openapi3/server/petstore/springboot-useoptional

* remove samples/openapi3/server/petstore/springboot-reactive

* update github workflow

* fix default in add, put operation
This commit is contained in:
William Cheng
2023-03-17 10:16:17 +08:00
committed by GitHub
parent e626b43e27
commit d0f7bd18ba
669 changed files with 8763 additions and 40246 deletions

View File

@@ -28,35 +28,35 @@ public class AdditionalPropertiesClass {
@JsonProperty("map_string")
@Valid
private Map<String, String> mapString = null;
private Map<String, String> mapString = new HashMap<>();
@JsonProperty("map_number")
@Valid
private Map<String, BigDecimal> mapNumber = null;
private Map<String, BigDecimal> mapNumber = new HashMap<>();
@JsonProperty("map_integer")
@Valid
private Map<String, Integer> mapInteger = null;
private Map<String, Integer> mapInteger = new HashMap<>();
@JsonProperty("map_boolean")
@Valid
private Map<String, Boolean> mapBoolean = null;
private Map<String, Boolean> mapBoolean = new HashMap<>();
@JsonProperty("map_array_integer")
@Valid
private Map<String, List<Integer>> mapArrayInteger = null;
private Map<String, List<Integer>> mapArrayInteger = new HashMap<>();
@JsonProperty("map_array_anytype")
@Valid
private Map<String, List<Object>> mapArrayAnytype = null;
private Map<String, List<Object>> mapArrayAnytype = new HashMap<>();
@JsonProperty("map_map_string")
@Valid
private Map<String, Map<String, String>> mapMapString = null;
private Map<String, Map<String, String>> mapMapString = new HashMap<>();
@JsonProperty("map_map_anytype")
@Valid
private Map<String, Map<String, Object>> mapMapAnytype = null;
private Map<String, Map<String, Object>> mapMapAnytype = new HashMap<>();
@JsonProperty("anytype_1")
private Object anytype1;

View File

@@ -27,7 +27,7 @@ public class ArrayOfArrayOfNumberOnly {
@JsonProperty("ArrayArrayNumber")
@Valid
private List<List<BigDecimal>> arrayArrayNumber = null;
private List<List<BigDecimal>> arrayArrayNumber = new ArrayList<>();
public ArrayOfArrayOfNumberOnly arrayArrayNumber(List<List<BigDecimal>> arrayArrayNumber) {
this.arrayArrayNumber = arrayArrayNumber;

View File

@@ -27,7 +27,7 @@ public class ArrayOfNumberOnly {
@JsonProperty("ArrayNumber")
@Valid
private List<BigDecimal> arrayNumber = null;
private List<BigDecimal> arrayNumber = new ArrayList<>();
public ArrayOfNumberOnly arrayNumber(List<BigDecimal> arrayNumber) {
this.arrayNumber = arrayNumber;

View File

@@ -27,15 +27,15 @@ public class ArrayTest {
@JsonProperty("array_of_string")
@Valid
private List<String> arrayOfString = null;
private List<String> arrayOfString = new ArrayList<>();
@JsonProperty("array_array_of_integer")
@Valid
private List<List<Long>> arrayArrayOfInteger = null;
private List<List<Long>> arrayArrayOfInteger = new ArrayList<>();
@JsonProperty("array_array_of_model")
@Valid
private List<List<ReadOnlyFirst>> arrayArrayOfModel = null;
private List<List<ReadOnlyFirst>> arrayArrayOfModel = new ArrayList<>();
public ArrayTest arrayOfString(List<String> arrayOfString) {
this.arrayOfString = arrayOfString;

View File

@@ -100,7 +100,7 @@ public class EnumArrays {
@JsonProperty("array_enum")
@Valid
private List<ArrayEnumEnum> arrayEnum = null;
private List<ArrayEnumEnum> arrayEnum = new ArrayList<>();
public EnumArrays justSymbol(JustSymbolEnum justSymbol) {
this.justSymbol = justSymbol;

View File

@@ -30,7 +30,7 @@ public class FileSchemaTestClass {
@JsonProperty("files")
@Valid
private List<@Valid File> files = null;
private List<@Valid File> files = new ArrayList<>();
public FileSchemaTestClass file(File file) {
this.file = file;

View File

@@ -27,7 +27,7 @@ public class MapTest {
@JsonProperty("map_map_of_string")
@Valid
private Map<String, Map<String, String>> mapMapOfString = null;
private Map<String, Map<String, String>> mapMapOfString = new HashMap<>();
/**
* Gets or Sets inner
@@ -66,15 +66,15 @@ public class MapTest {
@JsonProperty("map_of_enum_string")
@Valid
private Map<String, InnerEnum> mapOfEnumString = null;
private Map<String, InnerEnum> mapOfEnumString = new HashMap<>();
@JsonProperty("direct_map")
@Valid
private Map<String, Boolean> directMap = null;
private Map<String, Boolean> directMap = new HashMap<>();
@JsonProperty("indirect_map")
@Valid
private Map<String, Boolean> indirectMap = null;
private Map<String, Boolean> indirectMap = new HashMap<>();
public MapTest mapMapOfString(Map<String, Map<String, String>> mapMapOfString) {
this.mapMapOfString = mapMapOfString;

View File

@@ -37,7 +37,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass {
@JsonProperty("map")
@Valid
private Map<String, Animal> map = null;
private Map<String, Animal> map = new HashMap<>();
public MixedPropertiesAndAdditionalPropertiesClass uuid(UUID uuid) {
this.uuid = uuid;

View File

@@ -42,7 +42,7 @@ public class Pet {
@JsonProperty("tags")
@Valid
private List<@Valid Tag> tags = null;
private List<@Valid Tag> tags = new ArrayList<>();
/**
* pet status in the store
@@ -164,6 +164,9 @@ public class Pet {
}
public Pet addPhotoUrlsItem(String photoUrlsItem) {
if (this.photoUrls == null) {
this.photoUrls = new ArrayList<>();
}
this.photoUrls.add(photoUrlsItem);
return this;
}

View File

@@ -143,6 +143,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

@@ -166,6 +166,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

@@ -39,7 +39,7 @@ public class XmlItem {
@JsonProperty("wrapped_array")
@Valid
private List<Integer> wrappedArray = null;
private List<Integer> wrappedArray = new ArrayList<>();
@JsonProperty("name_string")
private String nameString;
@@ -55,11 +55,11 @@ public class XmlItem {
@JsonProperty("name_array")
@Valid
private List<Integer> nameArray = null;
private List<Integer> nameArray = new ArrayList<>();
@JsonProperty("name_wrapped_array")
@Valid
private List<Integer> nameWrappedArray = null;
private List<Integer> nameWrappedArray = new ArrayList<>();
@JsonProperty("prefix_string")
private String prefixString;
@@ -75,11 +75,11 @@ public class XmlItem {
@JsonProperty("prefix_array")
@Valid
private List<Integer> prefixArray = null;
private List<Integer> prefixArray = new ArrayList<>();
@JsonProperty("prefix_wrapped_array")
@Valid
private List<Integer> prefixWrappedArray = null;
private List<Integer> prefixWrappedArray = new ArrayList<>();
@JsonProperty("namespace_string")
private String namespaceString;
@@ -95,11 +95,11 @@ public class XmlItem {
@JsonProperty("namespace_array")
@Valid
private List<Integer> namespaceArray = null;
private List<Integer> namespaceArray = new ArrayList<>();
@JsonProperty("namespace_wrapped_array")
@Valid
private List<Integer> namespaceWrappedArray = null;
private List<Integer> namespaceWrappedArray = new ArrayList<>();
@JsonProperty("prefix_ns_string")
private String prefixNsString;
@@ -115,11 +115,11 @@ public class XmlItem {
@JsonProperty("prefix_ns_array")
@Valid
private List<Integer> prefixNsArray = null;
private List<Integer> prefixNsArray = new ArrayList<>();
@JsonProperty("prefix_ns_wrapped_array")
@Valid
private List<Integer> prefixNsWrappedArray = null;
private List<Integer> prefixNsWrappedArray = new ArrayList<>();
public XmlItem attributeString(String attributeString) {
this.attributeString = attributeString;