mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-06 01:26:12 +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:
@@ -40,7 +40,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
@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() {
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
@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() {
|
||||
}
|
||||
|
||||
@@ -42,13 +42,13 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
@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() {
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ public class Drawing extends HashMap<String, Fruit> {
|
||||
private JsonNullable<NullableShape> nullableShape = JsonNullable.<NullableShape>undefined();
|
||||
|
||||
public static final String JSON_PROPERTY_SHAPES = "shapes";
|
||||
private List<Shape> shapes = new ArrayList<>();
|
||||
private List<Shape> shapes;
|
||||
|
||||
public Drawing() {
|
||||
}
|
||||
|
||||
@@ -113,7 +113,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() {
|
||||
}
|
||||
|
||||
@@ -44,7 +44,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() {
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ public class NullableClass extends HashMap<String, Object> {
|
||||
private JsonNullable<List<Object>> arrayAndItemsNullableProp = JsonNullable.<List<Object>>undefined();
|
||||
|
||||
public static final String JSON_PROPERTY_ARRAY_ITEMS_NULLABLE = "array_items_nullable";
|
||||
private List<Object> arrayItemsNullable = new ArrayList<>();
|
||||
private List<Object> arrayItemsNullable;
|
||||
|
||||
public static final String JSON_PROPERTY_OBJECT_NULLABLE_PROP = "object_nullable_prop";
|
||||
private JsonNullable<Map<String, Object>> objectNullableProp = JsonNullable.<Map<String, Object>>undefined();
|
||||
|
||||
@@ -53,7 +53,7 @@ public class ObjectWithDeprecatedFields {
|
||||
private DeprecatedObject deprecatedRef;
|
||||
|
||||
public static final String JSON_PROPERTY_BARS = "bars";
|
||||
private List<String> bars = new ArrayList<>();
|
||||
private List<String> bars;
|
||||
|
||||
public ObjectWithDeprecatedFields() {
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ public class Pet {
|
||||
private List<String> photoUrls = new ArrayList<>();
|
||||
|
||||
public static final String JSON_PROPERTY_TAGS = "tags";
|
||||
private List<Tag> tags = new ArrayList<>();
|
||||
private List<Tag> tags;
|
||||
|
||||
/**
|
||||
* pet status in the store
|
||||
@@ -184,6 +184,9 @@ public class Pet {
|
||||
}
|
||||
|
||||
public Pet addPhotoUrlsItem(String photoUrlsItem) {
|
||||
if (this.photoUrls == null) {
|
||||
this.photoUrls = new ArrayList<>();
|
||||
}
|
||||
this.photoUrls.add(photoUrlsItem);
|
||||
return this;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user