mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-07 02:55:19 +00:00
[JAVA][Server] Fixed issue #1525: Fix model class field initializations (Regression since 3.3.1) (#1549)
* Fixed issue #1525. Adjust class field declarations with proper initializations. * Adjusted templates to add default only when it is exists.
This commit is contained in:
parent
0b029088f4
commit
95c744381b
@ -5,7 +5,7 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#seriali
|
||||
{{>enumClass}}{{/isContainer}}{{#isContainer}}{{#mostInnerItems}}
|
||||
|
||||
{{>enumClass}}{{/mostInnerItems}}{{/isContainer}}{{/isEnum}}
|
||||
private {{{datatypeWithEnum}}} {{name}} = {{{defaultValue}}};{{/vars}}
|
||||
private {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}};{{/vars}}
|
||||
|
||||
public {{classname}} () {
|
||||
|
||||
|
@ -6,7 +6,7 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#seriali
|
||||
{{>enumClass}}{{/isContainer}}{{#isContainer}}{{#mostInnerItems}}
|
||||
|
||||
{{>enumClass}}{{/mostInnerItems}}{{/isContainer}}{{/isEnum}}
|
||||
private {{{datatypeWithEnum}}} {{name}} = {{{defaultValue}}};{{/vars}}
|
||||
private {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}};{{/vars}}
|
||||
|
||||
{{#vars}}
|
||||
/**{{#description}}
|
||||
|
@ -1 +1 @@
|
||||
3.2.0-SNAPSHOT
|
||||
3.3.4-SNAPSHOT
|
@ -10,8 +10,8 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class Category {
|
||||
|
||||
private Long id = null;
|
||||
private String name = null;
|
||||
private Long id;
|
||||
private String name;
|
||||
|
||||
public Category () {
|
||||
|
||||
|
@ -10,9 +10,9 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class ModelApiResponse {
|
||||
|
||||
private Integer code = null;
|
||||
private String type = null;
|
||||
private String message = null;
|
||||
private Integer code;
|
||||
private String type;
|
||||
private String message;
|
||||
|
||||
public ModelApiResponse () {
|
||||
|
||||
|
@ -12,10 +12,10 @@ import java.time.OffsetDateTime;
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class Order {
|
||||
|
||||
private Long id = null;
|
||||
private Long petId = null;
|
||||
private Integer quantity = null;
|
||||
private OffsetDateTime shipDate = null;
|
||||
private Long id;
|
||||
private Long petId;
|
||||
private Integer quantity;
|
||||
private OffsetDateTime shipDate;
|
||||
|
||||
|
||||
public enum StatusEnum {
|
||||
@ -36,7 +36,7 @@ public class Order {
|
||||
}
|
||||
}
|
||||
|
||||
private StatusEnum status = null;
|
||||
private StatusEnum status;
|
||||
private Boolean complete = false;
|
||||
|
||||
public Order () {
|
||||
|
@ -15,9 +15,9 @@ import org.openapitools.server.api.model.Tag;
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class Pet {
|
||||
|
||||
private Long id = null;
|
||||
private Long id;
|
||||
private Category category = null;
|
||||
private String name = null;
|
||||
private String name;
|
||||
private List<String> photoUrls = new ArrayList<>();
|
||||
private List<Tag> tags = new ArrayList<>();
|
||||
|
||||
@ -40,7 +40,7 @@ public class Pet {
|
||||
}
|
||||
}
|
||||
|
||||
private StatusEnum status = null;
|
||||
private StatusEnum status;
|
||||
|
||||
public Pet () {
|
||||
|
||||
|
@ -10,8 +10,8 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class Tag {
|
||||
|
||||
private Long id = null;
|
||||
private String name = null;
|
||||
private Long id;
|
||||
private String name;
|
||||
|
||||
public Tag () {
|
||||
|
||||
|
@ -10,14 +10,14 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class User {
|
||||
|
||||
private Long id = null;
|
||||
private String username = null;
|
||||
private String firstName = null;
|
||||
private String lastName = null;
|
||||
private String email = null;
|
||||
private String password = null;
|
||||
private String phone = null;
|
||||
private Integer userStatus = null;
|
||||
private Long id;
|
||||
private String username;
|
||||
private String firstName;
|
||||
private String lastName;
|
||||
private String email;
|
||||
private String password;
|
||||
private String phone;
|
||||
private Integer userStatus;
|
||||
|
||||
public User () {
|
||||
|
||||
|
@ -118,8 +118,8 @@
|
||||
"type" : "array",
|
||||
"items" : {
|
||||
"type" : "string",
|
||||
"enum" : [ "available", "pending", "sold" ],
|
||||
"default" : "available"
|
||||
"default" : "available",
|
||||
"enum" : [ "available", "pending", "sold" ]
|
||||
}
|
||||
}
|
||||
} ],
|
||||
|
@ -1 +1 @@
|
||||
3.0.0-SNAPSHOT
|
||||
3.3.4-SNAPSHOT
|
@ -16,8 +16,8 @@ import io.swagger.annotations.ApiModelProperty;
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaUndertowServerCodegen")
|
||||
public class Category {
|
||||
|
||||
private Long id = null;
|
||||
private String name = null;
|
||||
private Long id;
|
||||
private String name;
|
||||
|
||||
/**
|
||||
**/
|
||||
|
@ -16,9 +16,9 @@ import io.swagger.annotations.ApiModelProperty;
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaUndertowServerCodegen")
|
||||
public class ModelApiResponse {
|
||||
|
||||
private Integer code = null;
|
||||
private String type = null;
|
||||
private String message = null;
|
||||
private Integer code;
|
||||
private String type;
|
||||
private String message;
|
||||
|
||||
/**
|
||||
**/
|
||||
|
@ -18,10 +18,10 @@ import java.util.Date;
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaUndertowServerCodegen")
|
||||
public class Order {
|
||||
|
||||
private Long id = null;
|
||||
private Long petId = null;
|
||||
private Integer quantity = null;
|
||||
private Date shipDate = null;
|
||||
private Long id;
|
||||
private Long petId;
|
||||
private Integer quantity;
|
||||
private Date shipDate;
|
||||
|
||||
|
||||
public enum StatusEnum {
|
||||
@ -42,7 +42,7 @@ public class Order {
|
||||
}
|
||||
}
|
||||
|
||||
private StatusEnum status = null;
|
||||
private StatusEnum status;
|
||||
private Boolean complete = false;
|
||||
|
||||
/**
|
||||
@ -141,7 +141,7 @@ public class Order {
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
@JsonProperty("complete")
|
||||
public Boolean isComplete() {
|
||||
public Boolean getComplete() {
|
||||
return complete;
|
||||
}
|
||||
public void setComplete(Boolean complete) {
|
||||
|
@ -21,9 +21,9 @@ import org.openapitools.model.Tag;
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaUndertowServerCodegen")
|
||||
public class Pet {
|
||||
|
||||
private Long id = null;
|
||||
private Long id;
|
||||
private Category category = null;
|
||||
private String name = null;
|
||||
private String name;
|
||||
private List<String> photoUrls = new ArrayList<String>();
|
||||
private List<Tag> tags = new ArrayList<Tag>();
|
||||
|
||||
@ -46,7 +46,7 @@ public class Pet {
|
||||
}
|
||||
}
|
||||
|
||||
private StatusEnum status = null;
|
||||
private StatusEnum status;
|
||||
|
||||
/**
|
||||
**/
|
||||
|
@ -16,8 +16,8 @@ import io.swagger.annotations.ApiModelProperty;
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaUndertowServerCodegen")
|
||||
public class Tag {
|
||||
|
||||
private Long id = null;
|
||||
private String name = null;
|
||||
private Long id;
|
||||
private String name;
|
||||
|
||||
/**
|
||||
**/
|
||||
|
@ -16,14 +16,14 @@ import io.swagger.annotations.ApiModelProperty;
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaUndertowServerCodegen")
|
||||
public class User {
|
||||
|
||||
private Long id = null;
|
||||
private String username = null;
|
||||
private String firstName = null;
|
||||
private String lastName = null;
|
||||
private String email = null;
|
||||
private String password = null;
|
||||
private String phone = null;
|
||||
private Integer userStatus = null;
|
||||
private Long id;
|
||||
private String username;
|
||||
private String firstName;
|
||||
private String lastName;
|
||||
private String email;
|
||||
private String password;
|
||||
private String phone;
|
||||
private Integer userStatus;
|
||||
|
||||
/**
|
||||
**/
|
||||
|
@ -108,6 +108,7 @@
|
||||
"in" : "query",
|
||||
"description" : "Status values that need to be considered for filter",
|
||||
"required" : true,
|
||||
"style" : "form",
|
||||
"explode" : false,
|
||||
"schema" : {
|
||||
"type" : "array",
|
||||
@ -162,6 +163,7 @@
|
||||
"in" : "query",
|
||||
"description" : "Tags to filter by",
|
||||
"required" : true,
|
||||
"style" : "form",
|
||||
"explode" : false,
|
||||
"schema" : {
|
||||
"type" : "array",
|
||||
|
Loading…
Reference in New Issue
Block a user