[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:
William Cheng
2023-02-16 10:37:36 +08:00
committed by GitHub
parent 8b0b4b5d04
commit 71c2abf81c
230 changed files with 645 additions and 839 deletions

View File

@@ -49,28 +49,28 @@ import org.openapitools.client.JSON;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class AdditionalPropertiesClass {
public static final String JSON_PROPERTY_MAP_STRING = "map_string";
private Map<String, String> mapString = null;
private Map<String, String> mapString = new HashMap<>();
public static final String JSON_PROPERTY_MAP_NUMBER = "map_number";
private Map<String, BigDecimal> mapNumber = null;
private Map<String, BigDecimal> mapNumber = new HashMap<>();
public static final String JSON_PROPERTY_MAP_INTEGER = "map_integer";
private Map<String, Integer> mapInteger = null;
private Map<String, Integer> mapInteger = new HashMap<>();
public static final String JSON_PROPERTY_MAP_BOOLEAN = "map_boolean";
private Map<String, Boolean> mapBoolean = null;
private Map<String, Boolean> mapBoolean = new HashMap<>();
public static final String JSON_PROPERTY_MAP_ARRAY_INTEGER = "map_array_integer";
private Map<String, List<Integer>> mapArrayInteger = null;
private Map<String, List<Integer>> mapArrayInteger = new HashMap<>();
public static final String JSON_PROPERTY_MAP_ARRAY_ANYTYPE = "map_array_anytype";
private Map<String, List<Object>> mapArrayAnytype = null;
private Map<String, List<Object>> mapArrayAnytype = new HashMap<>();
public static final String JSON_PROPERTY_MAP_MAP_STRING = "map_map_string";
private Map<String, Map<String, String>> mapMapString = null;
private Map<String, Map<String, String>> mapMapString = new HashMap<>();
public static final String JSON_PROPERTY_MAP_MAP_ANYTYPE = "map_map_anytype";
private Map<String, Map<String, Object>> mapMapAnytype = null;
private Map<String, Map<String, Object>> mapMapAnytype = new HashMap<>();
public static final String JSON_PROPERTY_ANYTYPE1 = "anytype_1";
private Object anytype1;

View File

@@ -38,7 +38,7 @@ import org.openapitools.client.JSON;
@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 = null;
private List<List<BigDecimal>> arrayArrayNumber = new ArrayList<>();
public ArrayOfArrayOfNumberOnly() {
}

View File

@@ -38,7 +38,7 @@ import org.openapitools.client.JSON;
@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 = null;
private List<BigDecimal> arrayNumber = new ArrayList<>();
public ArrayOfNumberOnly() {
}

View File

@@ -40,13 +40,13 @@ import org.openapitools.client.JSON;
@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 = null;
private List<String> arrayOfString = new ArrayList<>();
public static final String JSON_PROPERTY_ARRAY_ARRAY_OF_INTEGER = "array_array_of_integer";
private List<List<Long>> arrayArrayOfInteger = null;
private List<List<Long>> arrayArrayOfInteger = new ArrayList<>();
public static final String JSON_PROPERTY_ARRAY_ARRAY_OF_MODEL = "array_array_of_model";
private List<List<ReadOnlyFirst>> arrayArrayOfModel = null;
private List<List<ReadOnlyFirst>> arrayArrayOfModel = new ArrayList<>();
public ArrayTest() {
}

View File

@@ -111,7 +111,7 @@ public class EnumArrays {
}
public static final String JSON_PROPERTY_ARRAY_ENUM = "array_enum";
private List<ArrayEnumEnum> arrayEnum = null;
private List<ArrayEnumEnum> arrayEnum = new ArrayList<>();
public EnumArrays() {
}

View File

@@ -42,7 +42,7 @@ public class FileSchemaTestClass {
private ModelFile _file;
public static final String JSON_PROPERTY_FILES = "files";
private List<ModelFile> files = null;
private List<ModelFile> files = new ArrayList<>();
public FileSchemaTestClass() {
}

View File

@@ -40,7 +40,7 @@ import org.openapitools.client.JSON;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class MapTest {
public static final String JSON_PROPERTY_MAP_MAP_OF_STRING = "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
@@ -78,13 +78,13 @@ public class MapTest {
}
public static final String JSON_PROPERTY_MAP_OF_ENUM_STRING = "map_of_enum_string";
private Map<String, InnerEnum> mapOfEnumString = null;
private Map<String, InnerEnum> mapOfEnumString = new HashMap<>();
public static final String JSON_PROPERTY_DIRECT_MAP = "direct_map";
private Map<String, Boolean> directMap = null;
private Map<String, Boolean> directMap = new HashMap<>();
public static final String JSON_PROPERTY_INDIRECT_MAP = "indirect_map";
private Map<String, Boolean> indirectMap = null;
private Map<String, Boolean> indirectMap = new HashMap<>();
public MapTest() {
}

View File

@@ -48,7 +48,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass {
private LocalDateTime dateTime;
public static final String JSON_PROPERTY_MAP = "map";
private Map<String, Animal> map = null;
private Map<String, Animal> map = new HashMap<>();
public MixedPropertiesAndAdditionalPropertiesClass() {
}

View File

@@ -59,7 +59,7 @@ public class Pet {
private Set<String> photoUrls = new LinkedHashSet<>();
public static final String JSON_PROPERTY_TAGS = "tags";
private List<Tag> tags = null;
private List<Tag> tags = new ArrayList<>();
/**
* pet status in the store

View File

@@ -78,7 +78,7 @@ public class XmlItem {
private Boolean attributeBoolean;
public static final String JSON_PROPERTY_WRAPPED_ARRAY = "wrapped_array";
private List<Integer> wrappedArray = null;
private List<Integer> wrappedArray = new ArrayList<>();
public static final String JSON_PROPERTY_NAME_STRING = "name_string";
private String nameString;
@@ -93,10 +93,10 @@ public class XmlItem {
private Boolean nameBoolean;
public static final String JSON_PROPERTY_NAME_ARRAY = "name_array";
private List<Integer> nameArray = null;
private List<Integer> nameArray = new ArrayList<>();
public static final String JSON_PROPERTY_NAME_WRAPPED_ARRAY = "name_wrapped_array";
private List<Integer> nameWrappedArray = null;
private List<Integer> nameWrappedArray = new ArrayList<>();
public static final String JSON_PROPERTY_PREFIX_STRING = "prefix_string";
private String prefixString;
@@ -111,10 +111,10 @@ public class XmlItem {
private Boolean prefixBoolean;
public static final String JSON_PROPERTY_PREFIX_ARRAY = "prefix_array";
private List<Integer> prefixArray = null;
private List<Integer> prefixArray = new ArrayList<>();
public static final String JSON_PROPERTY_PREFIX_WRAPPED_ARRAY = "prefix_wrapped_array";
private List<Integer> prefixWrappedArray = null;
private List<Integer> prefixWrappedArray = new ArrayList<>();
public static final String JSON_PROPERTY_NAMESPACE_STRING = "namespace_string";
private String namespaceString;
@@ -129,10 +129,10 @@ public class XmlItem {
private Boolean namespaceBoolean;
public static final String JSON_PROPERTY_NAMESPACE_ARRAY = "namespace_array";
private List<Integer> namespaceArray = null;
private List<Integer> namespaceArray = new ArrayList<>();
public static final String JSON_PROPERTY_NAMESPACE_WRAPPED_ARRAY = "namespace_wrapped_array";
private List<Integer> namespaceWrappedArray = null;
private List<Integer> namespaceWrappedArray = new ArrayList<>();
public static final String JSON_PROPERTY_PREFIX_NS_STRING = "prefix_ns_string";
private String prefixNsString;
@@ -147,10 +147,10 @@ public class XmlItem {
private Boolean prefixNsBoolean;
public static final String JSON_PROPERTY_PREFIX_NS_ARRAY = "prefix_ns_array";
private List<Integer> prefixNsArray = null;
private List<Integer> prefixNsArray = new ArrayList<>();
public static final String JSON_PROPERTY_PREFIX_NS_WRAPPED_ARRAY = "prefix_ns_wrapped_array";
private List<Integer> prefixNsWrappedArray = null;
private List<Integer> prefixNsWrappedArray = new ArrayList<>();
public XmlItem() {
}