[java-spring] Move JsonProperty annotation from field to getter (#13781) (fix #5705)

* 5705: Move JsonProperty annotation to the getters

* Regenerate samples

* Add jackson check

* Add test

* Minor fix

* Fix test

* Fix version

* [Java][Spring] update test & samples; add serialization/deserialization test

---------

Co-authored-by: Oleh Kurpiak <oleh.kurpiak@gmail.com>
This commit is contained in:
César Revert
2023-03-19 12:59:48 +01:00
committed by GitHub
parent 162623e49b
commit 6e649af9a7
1067 changed files with 6984 additions and 3468 deletions

View File

@@ -20,10 +20,8 @@ import javax.annotation.Generated;
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class Category {
@JsonProperty("id")
private Long id;
@JsonProperty("name")
private String name;
public Category id(Long id) {
@@ -36,6 +34,7 @@ public class Category {
* @return id
*/
@JsonProperty("id")
public Long getId() {
return id;
}
@@ -54,6 +53,7 @@ public class Category {
* @return name
*/
@Pattern(regexp = "^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$")
@JsonProperty("name")
public String getName() {
return name;
}

View File

@@ -22,13 +22,10 @@ import javax.annotation.Generated;
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class ModelApiResponse {
@JsonProperty("code")
private Integer code;
@JsonProperty("type")
private String type;
@JsonProperty("message")
private String message;
public ModelApiResponse code(Integer code) {
@@ -41,6 +38,7 @@ public class ModelApiResponse {
* @return code
*/
@JsonProperty("code")
public Integer getCode() {
return code;
}
@@ -59,6 +57,7 @@ public class ModelApiResponse {
* @return type
*/
@JsonProperty("type")
public String getType() {
return type;
}
@@ -77,6 +76,7 @@ public class ModelApiResponse {
* @return message
*/
@JsonProperty("message")
public String getMessage() {
return message;
}

View File

@@ -23,16 +23,12 @@ import javax.annotation.Generated;
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class Order {
@JsonProperty("id")
private Long id;
@JsonProperty("petId")
private Long petId;
@JsonProperty("quantity")
private Integer quantity;
@JsonProperty("shipDate")
@DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)
private OffsetDateTime shipDate;
@@ -73,10 +69,8 @@ public class Order {
}
}
@JsonProperty("status")
private StatusEnum status;
@JsonProperty("complete")
private Boolean complete = false;
public Order id(Long id) {
@@ -89,6 +83,7 @@ public class Order {
* @return id
*/
@JsonProperty("id")
public Long getId() {
return id;
}
@@ -107,6 +102,7 @@ public class Order {
* @return petId
*/
@JsonProperty("petId")
public Long getPetId() {
return petId;
}
@@ -125,6 +121,7 @@ public class Order {
* @return quantity
*/
@JsonProperty("quantity")
public Integer getQuantity() {
return quantity;
}
@@ -143,6 +140,7 @@ public class Order {
* @return shipDate
*/
@Valid
@JsonProperty("shipDate")
public OffsetDateTime getShipDate() {
return shipDate;
}
@@ -161,6 +159,7 @@ public class Order {
* @return status
*/
@JsonProperty("status")
public StatusEnum getStatus() {
return status;
}
@@ -179,6 +178,7 @@ public class Order {
* @return complete
*/
@JsonProperty("complete")
public Boolean getComplete() {
return complete;
}

View File

@@ -25,20 +25,15 @@ import javax.annotation.Generated;
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class Pet {
@JsonProperty("id")
private Long id;
@JsonProperty("category")
private Category category;
@JsonProperty("name")
private String name;
@JsonProperty("photoUrls")
@Valid
private List<String> photoUrls = new ArrayList<>();
@JsonProperty("tags")
@Valid
private List<@Valid Tag> tags;
@@ -79,7 +74,6 @@ public class Pet {
}
}
@JsonProperty("status")
private StatusEnum status;
/**
@@ -109,6 +103,7 @@ public class Pet {
* @return id
*/
@JsonProperty("id")
public Long getId() {
return id;
}
@@ -127,6 +122,7 @@ public class Pet {
* @return category
*/
@Valid
@JsonProperty("category")
public Category getCategory() {
return category;
}
@@ -145,6 +141,7 @@ public class Pet {
* @return name
*/
@NotNull
@JsonProperty("name")
public String getName() {
return name;
}
@@ -171,6 +168,7 @@ public class Pet {
* @return photoUrls
*/
@NotNull
@JsonProperty("photoUrls")
public List<String> getPhotoUrls() {
return photoUrls;
}
@@ -197,6 +195,7 @@ public class Pet {
* @return tags
*/
@Valid
@JsonProperty("tags")
public List<@Valid Tag> getTags() {
return tags;
}
@@ -215,6 +214,7 @@ public class Pet {
* @return status
*/
@JsonProperty("status")
public StatusEnum getStatus() {
return status;
}

View File

@@ -20,10 +20,8 @@ import javax.annotation.Generated;
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class Tag {
@JsonProperty("id")
private Long id;
@JsonProperty("name")
private String name;
public Tag id(Long id) {
@@ -36,6 +34,7 @@ public class Tag {
* @return id
*/
@JsonProperty("id")
public Long getId() {
return id;
}
@@ -54,6 +53,7 @@ public class Tag {
* @return name
*/
@JsonProperty("name")
public String getName() {
return name;
}

View File

@@ -20,28 +20,20 @@ import javax.annotation.Generated;
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class User {
@JsonProperty("id")
private Long id;
@JsonProperty("username")
private String username;
@JsonProperty("firstName")
private String firstName;
@JsonProperty("lastName")
private String lastName;
@JsonProperty("email")
private String email;
@JsonProperty("password")
private String password;
@JsonProperty("phone")
private String phone;
@JsonProperty("userStatus")
private Integer userStatus;
public User id(Long id) {
@@ -54,6 +46,7 @@ public class User {
* @return id
*/
@JsonProperty("id")
public Long getId() {
return id;
}
@@ -72,6 +65,7 @@ public class User {
* @return username
*/
@JsonProperty("username")
public String getUsername() {
return username;
}
@@ -90,6 +84,7 @@ public class User {
* @return firstName
*/
@JsonProperty("firstName")
public String getFirstName() {
return firstName;
}
@@ -108,6 +103,7 @@ public class User {
* @return lastName
*/
@JsonProperty("lastName")
public String getLastName() {
return lastName;
}
@@ -126,6 +122,7 @@ public class User {
* @return email
*/
@JsonProperty("email")
public String getEmail() {
return email;
}
@@ -144,6 +141,7 @@ public class User {
* @return password
*/
@JsonProperty("password")
public String getPassword() {
return password;
}
@@ -162,6 +160,7 @@ public class User {
* @return phone
*/
@JsonProperty("phone")
public String getPhone() {
return phone;
}
@@ -180,6 +179,7 @@ public class User {
* @return userStatus
*/
@JsonProperty("userStatus")
public Integer getUserStatus() {
return userStatus;
}