forked from loafle/openapi-generator-original
Pass optional as null (#7066)
* Pass optional as null * Addressing review comments * Addressing review comments-2 * Addressing review comments-3
This commit is contained in:
committed by
William Cheng
parent
61e706ba6f
commit
a4fbbb5999
@@ -37,8 +37,13 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {
|
||||
* {{{description}}}
|
||||
**/
|
||||
{{/description}}
|
||||
private {{{datatypeWithEnum}}} {{name}} = {{{defaultValue}}};{{/vars}}
|
||||
|
||||
{{#isContainer}}
|
||||
private {{{datatypeWithEnum}}} {{name}}{{#required}} = {{{defaultValue}}}{{/required}}{{^required}} = null{{/required}};
|
||||
{{/isContainer}}
|
||||
{{^isContainer}}
|
||||
private {{{datatypeWithEnum}}} {{name}} = {{{defaultValue}}};
|
||||
{{/isContainer}}
|
||||
{{/vars}}
|
||||
{{#vars}}
|
||||
/**
|
||||
{{#description}}
|
||||
|
||||
@@ -18,10 +18,10 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
public class AdditionalPropertiesClass {
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private Map<String, String> mapProperty = new HashMap<String, String>();
|
||||
@ApiModelProperty(value = "")
|
||||
private Map<String, Map<String, String>> mapOfMapProperty = new HashMap<String, Map<String, String>>();
|
||||
private Map<String, String> mapProperty = null;
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private Map<String, Map<String, String>> mapOfMapProperty = null;
|
||||
/**
|
||||
* Get mapProperty
|
||||
* @return mapProperty
|
||||
|
||||
@@ -18,9 +18,9 @@ public class Animal {
|
||||
|
||||
@ApiModelProperty(required = true, value = "")
|
||||
private String className = null;
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private String color = "red";
|
||||
|
||||
/**
|
||||
* Get className
|
||||
* @return className
|
||||
|
||||
@@ -17,8 +17,6 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
public class AnimalFarm extends ArrayList<Animal> {
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
@@ -18,8 +18,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
public class ArrayOfArrayOfNumberOnly {
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private List<List<BigDecimal>> arrayArrayNumber = new ArrayList<List<BigDecimal>>();
|
||||
|
||||
private List<List<BigDecimal>> arrayArrayNumber = null;
|
||||
/**
|
||||
* Get arrayArrayNumber
|
||||
* @return arrayArrayNumber
|
||||
|
||||
@@ -18,8 +18,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
public class ArrayOfNumberOnly {
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private List<BigDecimal> arrayNumber = new ArrayList<BigDecimal>();
|
||||
|
||||
private List<BigDecimal> arrayNumber = null;
|
||||
/**
|
||||
* Get arrayNumber
|
||||
* @return arrayNumber
|
||||
|
||||
@@ -18,12 +18,13 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
public class ArrayTest {
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private List<String> arrayOfString = new ArrayList<String>();
|
||||
@ApiModelProperty(value = "")
|
||||
private List<List<Long>> arrayArrayOfInteger = new ArrayList<List<Long>>();
|
||||
@ApiModelProperty(value = "")
|
||||
private List<List<ReadOnlyFirst>> arrayArrayOfModel = new ArrayList<List<ReadOnlyFirst>>();
|
||||
private List<String> arrayOfString = null;
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private List<List<Long>> arrayArrayOfInteger = null;
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private List<List<ReadOnlyFirst>> arrayArrayOfModel = null;
|
||||
/**
|
||||
* Get arrayOfString
|
||||
* @return arrayOfString
|
||||
|
||||
@@ -16,20 +16,24 @@ public class Capitalization {
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private String smallCamel = null;
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private String capitalCamel = null;
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private String smallSnake = null;
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private String capitalSnake = null;
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private String scAETHFlowPoints = null;
|
||||
|
||||
@ApiModelProperty(value = "Name of the pet ")
|
||||
/**
|
||||
* Name of the pet
|
||||
**/
|
||||
private String ATT_NAME = null;
|
||||
|
||||
/**
|
||||
* Get smallCamel
|
||||
* @return smallCamel
|
||||
|
||||
@@ -17,7 +17,6 @@ public class Cat extends Animal {
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private Boolean declawed = null;
|
||||
|
||||
/**
|
||||
* Get declawed
|
||||
* @return declawed
|
||||
|
||||
@@ -16,9 +16,9 @@ public class Category {
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private Long id = null;
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private String name = null;
|
||||
|
||||
/**
|
||||
* Get id
|
||||
* @return id
|
||||
|
||||
@@ -21,7 +21,6 @@ public class ClassModel {
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private String propertyClass = null;
|
||||
|
||||
/**
|
||||
* Get propertyClass
|
||||
* @return propertyClass
|
||||
|
||||
@@ -16,7 +16,6 @@ public class Client {
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private String client = null;
|
||||
|
||||
/**
|
||||
* Get client
|
||||
* @return client
|
||||
|
||||
@@ -17,7 +17,6 @@ public class Dog extends Animal {
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private String breed = null;
|
||||
|
||||
/**
|
||||
* Get breed
|
||||
* @return breed
|
||||
|
||||
@@ -52,6 +52,7 @@ public enum JustSymbolEnum {
|
||||
@ApiModelProperty(value = "")
|
||||
private JustSymbolEnum justSymbol = null;
|
||||
|
||||
|
||||
@XmlType(name="ArrayEnumEnum")
|
||||
@XmlEnum(String.class)
|
||||
public enum ArrayEnumEnum {
|
||||
@@ -85,8 +86,7 @@ public enum ArrayEnumEnum {
|
||||
}
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private List<ArrayEnumEnum> arrayEnum = new ArrayList<ArrayEnumEnum>();
|
||||
|
||||
private List<ArrayEnumEnum> arrayEnum = null;
|
||||
/**
|
||||
* Get justSymbol
|
||||
* @return justSymbol
|
||||
|
||||
@@ -51,6 +51,7 @@ public enum EnumStringEnum {
|
||||
@ApiModelProperty(value = "")
|
||||
private EnumStringEnum enumString = null;
|
||||
|
||||
|
||||
@XmlType(name="EnumIntegerEnum")
|
||||
@XmlEnum(Integer.class)
|
||||
public enum EnumIntegerEnum {
|
||||
@@ -86,6 +87,7 @@ public enum EnumIntegerEnum {
|
||||
@ApiModelProperty(value = "")
|
||||
private EnumIntegerEnum enumInteger = null;
|
||||
|
||||
|
||||
@XmlType(name="EnumNumberEnum")
|
||||
@XmlEnum(Double.class)
|
||||
public enum EnumNumberEnum {
|
||||
@@ -120,9 +122,9 @@ public enum EnumNumberEnum {
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private EnumNumberEnum enumNumber = null;
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private OuterEnum outerEnum = null;
|
||||
|
||||
/**
|
||||
* Get enumString
|
||||
* @return enumString
|
||||
|
||||
@@ -20,31 +20,42 @@ public class FormatTest {
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private Integer integer = null;
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private Integer int32 = null;
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private Long int64 = null;
|
||||
|
||||
@ApiModelProperty(required = true, value = "")
|
||||
private BigDecimal number = null;
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private Float _float = null;
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private Double _double = null;
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private String string = null;
|
||||
|
||||
@ApiModelProperty(required = true, value = "")
|
||||
private byte[] _byte = null;
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private byte[] binary = null;
|
||||
|
||||
@ApiModelProperty(required = true, value = "")
|
||||
private LocalDate date = null;
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private Date dateTime = null;
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private UUID uuid = null;
|
||||
|
||||
@ApiModelProperty(required = true, value = "")
|
||||
private String password = null;
|
||||
|
||||
/**
|
||||
* Get integer
|
||||
* minimum: 10
|
||||
|
||||
@@ -16,9 +16,9 @@ public class HasOnlyReadOnly {
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private String bar = null;
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private String foo = null;
|
||||
|
||||
/**
|
||||
* Get bar
|
||||
* @return bar
|
||||
|
||||
@@ -18,7 +18,8 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
public class MapTest {
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private Map<String, Map<String, String>> mapMapOfString = new HashMap<String, Map<String, String>>();
|
||||
private Map<String, Map<String, String>> mapMapOfString = null;
|
||||
|
||||
|
||||
@XmlType(name="InnerEnum")
|
||||
@XmlEnum(String.class)
|
||||
@@ -53,8 +54,7 @@ public enum InnerEnum {
|
||||
}
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private Map<String, InnerEnum> mapOfEnumString = new HashMap<String, InnerEnum>();
|
||||
|
||||
private Map<String, InnerEnum> mapOfEnumString = null;
|
||||
/**
|
||||
* Get mapMapOfString
|
||||
* @return mapMapOfString
|
||||
|
||||
@@ -22,11 +22,12 @@ public class MixedPropertiesAndAdditionalPropertiesClass {
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private UUID uuid = null;
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private Date dateTime = null;
|
||||
@ApiModelProperty(value = "")
|
||||
private Map<String, Animal> map = new HashMap<String, Animal>();
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private Map<String, Animal> map = null;
|
||||
/**
|
||||
* Get uuid
|
||||
* @return uuid
|
||||
|
||||
@@ -21,9 +21,9 @@ public class Model200Response {
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private Integer name = null;
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private String propertyClass = null;
|
||||
|
||||
/**
|
||||
* Get name
|
||||
* @return name
|
||||
|
||||
@@ -16,11 +16,12 @@ public class ModelApiResponse {
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private Integer code = null;
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private String type = null;
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private String message = null;
|
||||
|
||||
/**
|
||||
* Get code
|
||||
* @return code
|
||||
|
||||
@@ -21,7 +21,6 @@ public class ModelReturn {
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private Integer _return = null;
|
||||
|
||||
/**
|
||||
* Get _return
|
||||
* @return _return
|
||||
|
||||
@@ -21,13 +21,15 @@ public class Name {
|
||||
|
||||
@ApiModelProperty(required = true, value = "")
|
||||
private Integer name = null;
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private Integer snakeCase = null;
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private String property = null;
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private Integer _123Number = null;
|
||||
|
||||
/**
|
||||
* Get name
|
||||
* @return name
|
||||
|
||||
@@ -17,7 +17,6 @@ public class NumberOnly {
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private BigDecimal justNumber = null;
|
||||
|
||||
/**
|
||||
* Get justNumber
|
||||
* @return justNumber
|
||||
|
||||
@@ -17,13 +17,17 @@ public class Order {
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private Long id = null;
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private Long petId = null;
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private Integer quantity = null;
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private Date shipDate = null;
|
||||
|
||||
|
||||
@XmlType(name="StatusEnum")
|
||||
@XmlEnum(String.class)
|
||||
public enum StatusEnum {
|
||||
@@ -61,9 +65,9 @@ public enum StatusEnum {
|
||||
* Order Status
|
||||
**/
|
||||
private StatusEnum status = null;
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private Boolean complete = false;
|
||||
|
||||
/**
|
||||
* Get id
|
||||
* @return id
|
||||
|
||||
@@ -17,11 +17,12 @@ public class OuterComposite {
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private BigDecimal myNumber = null;
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private String myString = null;
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private Boolean myBoolean = null;
|
||||
|
||||
/**
|
||||
* Get myNumber
|
||||
* @return myNumber
|
||||
|
||||
@@ -20,14 +20,19 @@ public class Pet {
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private Long id = null;
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private Category category = null;
|
||||
|
||||
@ApiModelProperty(example = "doggie", required = true, value = "")
|
||||
private String name = null;
|
||||
|
||||
@ApiModelProperty(required = true, value = "")
|
||||
private List<String> photoUrls = new ArrayList<String>();
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private List<Tag> tags = new ArrayList<Tag>();
|
||||
private List<Tag> tags = null;
|
||||
|
||||
|
||||
@XmlType(name="StatusEnum")
|
||||
@XmlEnum(String.class)
|
||||
@@ -66,7 +71,6 @@ public enum StatusEnum {
|
||||
* pet status in the store
|
||||
**/
|
||||
private StatusEnum status = null;
|
||||
|
||||
/**
|
||||
* Get id
|
||||
* @return id
|
||||
|
||||
@@ -16,9 +16,9 @@ public class ReadOnlyFirst {
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private String bar = null;
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private String baz = null;
|
||||
|
||||
/**
|
||||
* Get bar
|
||||
* @return bar
|
||||
|
||||
@@ -16,7 +16,6 @@ public class SpecialModelName {
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private Long specialPropertyName = null;
|
||||
|
||||
/**
|
||||
* Get specialPropertyName
|
||||
* @return specialPropertyName
|
||||
|
||||
@@ -16,9 +16,9 @@ public class Tag {
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private Long id = null;
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private String name = null;
|
||||
|
||||
/**
|
||||
* Get id
|
||||
* @return id
|
||||
|
||||
@@ -16,24 +16,30 @@ public class User {
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private Long id = null;
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private String username = null;
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private String firstName = null;
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private String lastName = null;
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private String email = null;
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private String password = null;
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private String phone = null;
|
||||
|
||||
@ApiModelProperty(value = "User Status")
|
||||
/**
|
||||
* User Status
|
||||
**/
|
||||
private Integer userStatus = null;
|
||||
|
||||
/**
|
||||
* Get id
|
||||
* @return id
|
||||
|
||||
Reference in New Issue
Block a user