Skip to content

Commit

Permalink
[Java][JAX-RS-CXF] Add JsonProperty to POJO (#6710)
Browse files Browse the repository at this point in the history
* Included Open Systems International in the list of companies using Swagger Codegen

* Force Jackson to use the real names of the properties of the Data type defined in the YAML

* Update of the Petstore CXF server sample

* Update of the Petstore CXF client sample

* Update of the Petstore CXF server annotated base path sample

* Update of the Petstore CXF server non spring application sample

* Changed {{name}} for {{baseName}} following the correction posted by @wing328

* Update of the Petstore CXF server sample
  • Loading branch information
gustavoapaz authored and wing328 committed Oct 19, 2017
1 parent e4abddf commit d378941
Show file tree
Hide file tree
Showing 49 changed files with 217 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlEnumValue;
import com.fasterxml.jackson.annotation.JsonProperty;

{{#withXml}}
@XmlAccessorType(XmlAccessType.FIELD)
Expand Down Expand Up @@ -46,6 +47,7 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {
{{/maximum}}
* @return {{name}}
**/
@JsonProperty("{{baseName}}")
{{#vendorExtensions.extraAnnotation}}
{{{vendorExtensions.extraAnnotation}}}
{{/vendorExtensions.extraAnnotation}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlEnumValue;
import com.fasterxml.jackson.annotation.JsonProperty;

@ApiModel(description="A category for a pet")
public class Category {
Expand All @@ -24,6 +25,7 @@ public class Category {
* Get id
* @return id
**/
@JsonProperty("id")
public Long getId() {
return id;
}
Expand All @@ -41,6 +43,7 @@ public Category id(Long id) {
* Get name
* @return name
**/
@JsonProperty("name")
public String getName() {
return name;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlEnumValue;
import com.fasterxml.jackson.annotation.JsonProperty;

@ApiModel(description="Describes the result of uploading an image resource")
public class ModelApiResponse {
Expand All @@ -26,6 +27,7 @@ public class ModelApiResponse {
* Get code
* @return code
**/
@JsonProperty("code")
public Integer getCode() {
return code;
}
Expand All @@ -43,6 +45,7 @@ public ModelApiResponse code(Integer code) {
* Get type
* @return type
**/
@JsonProperty("type")
public String getType() {
return type;
}
Expand All @@ -60,6 +63,7 @@ public ModelApiResponse type(String type) {
* Get message
* @return message
**/
@JsonProperty("message")
public String getMessage() {
return message;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlEnumValue;
import com.fasterxml.jackson.annotation.JsonProperty;

@ApiModel(description="An order for a pets from the pet store")
public class Order {
Expand Down Expand Up @@ -66,6 +67,7 @@ public static StatusEnum fromValue(String v) {
* Get id
* @return id
**/
@JsonProperty("id")
public Long getId() {
return id;
}
Expand All @@ -83,6 +85,7 @@ public Order id(Long id) {
* Get petId
* @return petId
**/
@JsonProperty("petId")
public Long getPetId() {
return petId;
}
Expand All @@ -100,6 +103,7 @@ public Order petId(Long petId) {
* Get quantity
* @return quantity
**/
@JsonProperty("quantity")
public Integer getQuantity() {
return quantity;
}
Expand All @@ -117,6 +121,7 @@ public Order quantity(Integer quantity) {
* Get shipDate
* @return shipDate
**/
@JsonProperty("shipDate")
public Date getShipDate() {
return shipDate;
}
Expand All @@ -134,6 +139,7 @@ public Order shipDate(Date shipDate) {
* Order Status
* @return status
**/
@JsonProperty("status")
public StatusEnum getStatus() {
return status;
}
Expand All @@ -151,6 +157,7 @@ public Order status(StatusEnum status) {
* Get complete
* @return complete
**/
@JsonProperty("complete")
public Boolean isComplete() {
return complete;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlEnumValue;
import com.fasterxml.jackson.annotation.JsonProperty;

@ApiModel(description="A pet for sale in the pet store")
public class Pet {
Expand Down Expand Up @@ -69,6 +70,7 @@ public static StatusEnum fromValue(String v) {
* Get id
* @return id
**/
@JsonProperty("id")
public Long getId() {
return id;
}
Expand All @@ -86,6 +88,7 @@ public Pet id(Long id) {
* Get category
* @return category
**/
@JsonProperty("category")
public Category getCategory() {
return category;
}
Expand All @@ -103,6 +106,7 @@ public Pet category(Category category) {
* Get name
* @return name
**/
@JsonProperty("name")
@NotNull
public String getName() {
return name;
Expand All @@ -121,6 +125,7 @@ public Pet name(String name) {
* Get photoUrls
* @return photoUrls
**/
@JsonProperty("photoUrls")
@NotNull
public List<String> getPhotoUrls() {
return photoUrls;
Expand All @@ -144,6 +149,7 @@ public Pet addPhotoUrlsItem(String photoUrlsItem) {
* Get tags
* @return tags
**/
@JsonProperty("tags")
public List<Tag> getTags() {
return tags;
}
Expand All @@ -166,6 +172,7 @@ public Pet addTagsItem(Tag tagsItem) {
* pet status in the store
* @return status
**/
@JsonProperty("status")
public StatusEnum getStatus() {
return status;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlEnumValue;
import com.fasterxml.jackson.annotation.JsonProperty;

@ApiModel(description="A tag for a pet")
public class Tag {
Expand All @@ -24,6 +25,7 @@ public class Tag {
* Get id
* @return id
**/
@JsonProperty("id")
public Long getId() {
return id;
}
Expand All @@ -41,6 +43,7 @@ public Tag id(Long id) {
* Get name
* @return name
**/
@JsonProperty("name")
public String getName() {
return name;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlEnumValue;
import com.fasterxml.jackson.annotation.JsonProperty;

@ApiModel(description="A User who is purchasing from the pet store")
public class User {
Expand All @@ -36,6 +37,7 @@ public class User {
* Get id
* @return id
**/
@JsonProperty("id")
public Long getId() {
return id;
}
Expand All @@ -53,6 +55,7 @@ public User id(Long id) {
* Get username
* @return username
**/
@JsonProperty("username")
public String getUsername() {
return username;
}
Expand All @@ -70,6 +73,7 @@ public User username(String username) {
* Get firstName
* @return firstName
**/
@JsonProperty("firstName")
public String getFirstName() {
return firstName;
}
Expand All @@ -87,6 +91,7 @@ public User firstName(String firstName) {
* Get lastName
* @return lastName
**/
@JsonProperty("lastName")
public String getLastName() {
return lastName;
}
Expand All @@ -104,6 +109,7 @@ public User lastName(String lastName) {
* Get email
* @return email
**/
@JsonProperty("email")
public String getEmail() {
return email;
}
Expand All @@ -121,6 +127,7 @@ public User email(String email) {
* Get password
* @return password
**/
@JsonProperty("password")
public String getPassword() {
return password;
}
Expand All @@ -138,6 +145,7 @@ public User password(String password) {
* Get phone
* @return phone
**/
@JsonProperty("phone")
public String getPhone() {
return phone;
}
Expand All @@ -155,6 +163,7 @@ public User phone(String phone) {
* User Status
* @return userStatus
**/
@JsonProperty("userStatus")
public Integer getUserStatus() {
return userStatus;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlEnumValue;
import com.fasterxml.jackson.annotation.JsonProperty;

@ApiModel(description="A category for a pet")
public class Category {
Expand All @@ -24,6 +25,7 @@ public class Category {
* Get id
* @return id
**/
@JsonProperty("id")
public Long getId() {
return id;
}
Expand All @@ -41,6 +43,7 @@ public Category id(Long id) {
* Get name
* @return name
**/
@JsonProperty("name")
public String getName() {
return name;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlEnumValue;
import com.fasterxml.jackson.annotation.JsonProperty;

@ApiModel(description="Describes the result of uploading an image resource")
public class ModelApiResponse {
Expand All @@ -26,6 +27,7 @@ public class ModelApiResponse {
* Get code
* @return code
**/
@JsonProperty("code")
public Integer getCode() {
return code;
}
Expand All @@ -43,6 +45,7 @@ public ModelApiResponse code(Integer code) {
* Get type
* @return type
**/
@JsonProperty("type")
public String getType() {
return type;
}
Expand All @@ -60,6 +63,7 @@ public ModelApiResponse type(String type) {
* Get message
* @return message
**/
@JsonProperty("message")
public String getMessage() {
return message;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlEnumValue;
import com.fasterxml.jackson.annotation.JsonProperty;

@ApiModel(description="An order for a pets from the pet store")
public class Order {
Expand Down Expand Up @@ -66,6 +67,7 @@ public static StatusEnum fromValue(String v) {
* Get id
* @return id
**/
@JsonProperty("id")
public Long getId() {
return id;
}
Expand All @@ -83,6 +85,7 @@ public Order id(Long id) {
* Get petId
* @return petId
**/
@JsonProperty("petId")
public Long getPetId() {
return petId;
}
Expand All @@ -100,6 +103,7 @@ public Order petId(Long petId) {
* Get quantity
* @return quantity
**/
@JsonProperty("quantity")
public Integer getQuantity() {
return quantity;
}
Expand All @@ -117,6 +121,7 @@ public Order quantity(Integer quantity) {
* Get shipDate
* @return shipDate
**/
@JsonProperty("shipDate")
public Date getShipDate() {
return shipDate;
}
Expand All @@ -134,6 +139,7 @@ public Order shipDate(Date shipDate) {
* Order Status
* @return status
**/
@JsonProperty("status")
public StatusEnum getStatus() {
return status;
}
Expand All @@ -151,6 +157,7 @@ public Order status(StatusEnum status) {
* Get complete
* @return complete
**/
@JsonProperty("complete")
public Boolean isComplete() {
return complete;
}
Expand Down
Loading

0 comments on commit d378941

Please sign in to comment.