fixed models

This commit is contained in:
Tony Tam
2015-02-16 18:03:15 -08:00
parent 15fde46ca5
commit 026c93a104
8 changed files with 130 additions and 83 deletions

View File

@@ -4,6 +4,7 @@ package {{package}};
{{/imports}} {{/imports}}
import com.wordnik.swagger.annotations.*; import com.wordnik.swagger.annotations.*;
import com.fasterxml.jackson.annotation.JsonProperty;
{{#models}} {{#models}}
{{#model}}{{#description}} {{#model}}{{#description}}
@@ -11,23 +12,26 @@ import com.wordnik.swagger.annotations.*;
* {{description}} * {{description}}
**/{{/description}} **/{{/description}}
@ApiModel(description = "{{{description}}}") @ApiModel(description = "{{{description}}}")
public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} { {{#vars}} public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {
{{#vars}}{{#isEnum}}
public enum {{datatypeWithEnum}} {
{{#allowableValues}}{{#values}} {{.}}, {{/values}}{{/allowableValues}}
};
private {{{datatypeWithEnum}}} {{name}} = {{{defaultValue}}};{{/isEnum}}{{^isEnum}}
private {{{datatype}}} {{name}} = {{{defaultValue}}};{{/isEnum}}{{/vars}}
{{#vars}}
/**{{#description}} /**{{#description}}
* {{{description}}}{{/description}}{{#minimum}} * {{{description}}}{{/description}}{{#minimum}}
* minimum: {{minimum}}{{/minimum}}{{#maximum}} * minimum: {{minimum}}{{/minimum}}{{#maximum}}
* maximum: {{maximum}}{{/maximum}} * maximum: {{maximum}}{{/maximum}}
**/ **/
private {{{datatype}}} {{name}} = {{{defaultValue}}};{{#isEnum}}
public enum {{datatype}} { {{#_enum}}{{.}}{{^-last}}, {{/-last}}{{/_enum}} };
{{/isEnum}}{{/vars}}
{{#vars}}
@ApiModelProperty(required = {{required}}, value = "{{{description}}}") @ApiModelProperty(required = {{required}}, value = "{{{description}}}")
public {{{datatype}}} {{getter}}() { @JsonProperty("{{name}}")
public {{{datatypeWithEnum}}} {{getter}}() {
return {{name}}; return {{name}};
} }
public void {{setter}}({{{datatype}}} {{name}}) { public void {{setter}}({{{datatypeWithEnum}}} {{name}}) {
this.{{name}} = {{name}}; this.{{name}} = {{name}};
} }

View File

@@ -207,6 +207,14 @@
<p class="param-description">ID of pet to update</p>
</div>
<div class="parameter">
<p class="param-description">Additional data to pass to server</p> <p class="param-description">Additional data to pass to server</p>
</div> </div>

View File

@@ -152,7 +152,8 @@ public class PetApi {
@ApiOperation(value = "uploads an image", notes = "", response = Void.class) @ApiOperation(value = "uploads an image", notes = "", response = Void.class)
@ApiResponses(value = { }) @ApiResponses(value = { })
public Response uploadFile(@ApiParam(value = "Additional data to pass to server" )@FormParam("additionalMetadata") String additionalMetadata, public Response uploadFile(@ApiParam(value = "ID of pet to update",required=true ) @PathParam("petId") Long petId,
@ApiParam(value = "Additional data to pass to server" )@FormParam("additionalMetadata") String additionalMetadata,
@ApiParam(value = "file to upload") @FormDataParam("file") InputStream inputStream, @ApiParam(value = "file to upload") @FormDataParam("file") InputStream inputStream,
@ApiParam(value = "file detail") @FormDataParam("file") FormDataContentDisposition fileDetail) @ApiParam(value = "file detail") @FormDataParam("file") FormDataContentDisposition fileDetail)
throws NotFoundException { throws NotFoundException {

View File

@@ -2,19 +2,20 @@ package io.swagger.model;
import com.wordnik.swagger.annotations.*; import com.wordnik.swagger.annotations.*;
import com.fasterxml.jackson.annotation.JsonProperty;
@ApiModel(description = "") @ApiModel(description = "")
public class Category { public class Category {
/**
**/
private Long id = null; private Long id = null;
/**
**/
private String name = null; private String name = null;
/**
**/
@ApiModelProperty(required = false, value = "") @ApiModelProperty(required = false, value = "")
@JsonProperty("id")
public Long getId() { public Long getId() {
return id; return id;
} }
@@ -23,7 +24,10 @@ public class Category {
} }
/**
**/
@ApiModelProperty(required = false, value = "") @ApiModelProperty(required = false, value = "")
@JsonProperty("name")
public String getName() { public String getName() {
return name; return name;
} }

View File

@@ -3,35 +3,27 @@ package io.swagger.model;
import java.util.Date; import java.util.Date;
import com.wordnik.swagger.annotations.*; import com.wordnik.swagger.annotations.*;
import com.fasterxml.jackson.annotation.JsonProperty;
@ApiModel(description = "") @ApiModel(description = "")
public class Order { public class Order {
/**
**/
private Long id = null; private Long id = null;
/**
**/
private Long petId = null; private Long petId = null;
/**
**/
private Integer quantity = null; private Integer quantity = null;
/**
**/
private Date shipDate = null; private Date shipDate = null;
/** public enum StatusEnum {
* Order Status placed, approved, delivered,
**/ };
private String status = null; private StatusEnum status = null;
public enum String { placed, approved, delivered };
/**
**/
private Boolean complete = null; private Boolean complete = null;
/**
**/
@ApiModelProperty(required = false, value = "") @ApiModelProperty(required = false, value = "")
@JsonProperty("id")
public Long getId() { public Long getId() {
return id; return id;
} }
@@ -40,7 +32,10 @@ public class Order {
} }
/**
**/
@ApiModelProperty(required = false, value = "") @ApiModelProperty(required = false, value = "")
@JsonProperty("petId")
public Long getPetId() { public Long getPetId() {
return petId; return petId;
} }
@@ -49,7 +44,10 @@ public class Order {
} }
/**
**/
@ApiModelProperty(required = false, value = "") @ApiModelProperty(required = false, value = "")
@JsonProperty("quantity")
public Integer getQuantity() { public Integer getQuantity() {
return quantity; return quantity;
} }
@@ -58,7 +56,10 @@ public class Order {
} }
/**
**/
@ApiModelProperty(required = false, value = "") @ApiModelProperty(required = false, value = "")
@JsonProperty("shipDate")
public Date getShipDate() { public Date getShipDate() {
return shipDate; return shipDate;
} }
@@ -67,16 +68,23 @@ public class Order {
} }
/**
* Order Status
**/
@ApiModelProperty(required = false, value = "Order Status") @ApiModelProperty(required = false, value = "Order Status")
public String getStatus() { @JsonProperty("status")
public StatusEnum getStatus() {
return status; return status;
} }
public void setStatus(String status) { public void setStatus(StatusEnum status) {
this.status = status; this.status = status;
} }
/**
**/
@ApiModelProperty(required = false, value = "") @ApiModelProperty(required = false, value = "")
@JsonProperty("complete")
public Boolean getComplete() { public Boolean getComplete() {
return complete; return complete;
} }

View File

@@ -5,35 +5,27 @@ import java.util.*;
import io.swagger.model.Tag; import io.swagger.model.Tag;
import com.wordnik.swagger.annotations.*; import com.wordnik.swagger.annotations.*;
import com.fasterxml.jackson.annotation.JsonProperty;
@ApiModel(description = "") @ApiModel(description = "")
public class Pet { public class Pet {
/**
**/
private Long id = null; private Long id = null;
/**
**/
private Category category = null; private Category category = null;
/**
**/
private String name = null; private String name = null;
/**
**/
private List<String> photoUrls = new ArrayList<String>() ; private List<String> photoUrls = new ArrayList<String>() ;
/**
**/
private List<Tag> tags = new ArrayList<Tag>() ; private List<Tag> tags = new ArrayList<Tag>() ;
public enum StatusEnum {
available, pending, sold,
};
private StatusEnum status = null;
/** /**
* pet status in the store
**/ **/
private String status = null;
public enum String { available, pending, sold };
@ApiModelProperty(required = false, value = "") @ApiModelProperty(required = false, value = "")
@JsonProperty("id")
public Long getId() { public Long getId() {
return id; return id;
} }
@@ -42,7 +34,10 @@ public class Pet {
} }
/**
**/
@ApiModelProperty(required = false, value = "") @ApiModelProperty(required = false, value = "")
@JsonProperty("category")
public Category getCategory() { public Category getCategory() {
return category; return category;
} }
@@ -51,7 +46,10 @@ public class Pet {
} }
/**
**/
@ApiModelProperty(required = true, value = "") @ApiModelProperty(required = true, value = "")
@JsonProperty("name")
public String getName() { public String getName() {
return name; return name;
} }
@@ -60,7 +58,10 @@ public class Pet {
} }
/**
**/
@ApiModelProperty(required = true, value = "") @ApiModelProperty(required = true, value = "")
@JsonProperty("photoUrls")
public List<String> getPhotoUrls() { public List<String> getPhotoUrls() {
return photoUrls; return photoUrls;
} }
@@ -69,7 +70,10 @@ public class Pet {
} }
/**
**/
@ApiModelProperty(required = false, value = "") @ApiModelProperty(required = false, value = "")
@JsonProperty("tags")
public List<Tag> getTags() { public List<Tag> getTags() {
return tags; return tags;
} }
@@ -78,11 +82,15 @@ public class Pet {
} }
/**
* pet status in the store
**/
@ApiModelProperty(required = false, value = "pet status in the store") @ApiModelProperty(required = false, value = "pet status in the store")
public String getStatus() { @JsonProperty("status")
public StatusEnum getStatus() {
return status; return status;
} }
public void setStatus(String status) { public void setStatus(StatusEnum status) {
this.status = status; this.status = status;
} }

View File

@@ -2,19 +2,20 @@ package io.swagger.model;
import com.wordnik.swagger.annotations.*; import com.wordnik.swagger.annotations.*;
import com.fasterxml.jackson.annotation.JsonProperty;
@ApiModel(description = "") @ApiModel(description = "")
public class Tag { public class Tag {
/**
**/
private Long id = null; private Long id = null;
/**
**/
private String name = null; private String name = null;
/**
**/
@ApiModelProperty(required = false, value = "") @ApiModelProperty(required = false, value = "")
@JsonProperty("id")
public Long getId() { public Long getId() {
return id; return id;
} }
@@ -23,7 +24,10 @@ public class Tag {
} }
/**
**/
@ApiModelProperty(required = false, value = "") @ApiModelProperty(required = false, value = "")
@JsonProperty("name")
public String getName() { public String getName() {
return name; return name;
} }

View File

@@ -2,38 +2,26 @@ package io.swagger.model;
import com.wordnik.swagger.annotations.*; import com.wordnik.swagger.annotations.*;
import com.fasterxml.jackson.annotation.JsonProperty;
@ApiModel(description = "") @ApiModel(description = "")
public class User { public class User {
/**
**/
private Long id = null; private Long id = null;
/**
**/
private String username = null; private String username = null;
/**
**/
private String firstName = null; private String firstName = null;
/**
**/
private String lastName = null; private String lastName = null;
/**
**/
private String email = null; private String email = null;
/**
**/
private String password = null; private String password = null;
/**
**/
private String phone = null; private String phone = null;
/**
* User Status
**/
private Integer userStatus = null; private Integer userStatus = null;
/**
**/
@ApiModelProperty(required = false, value = "") @ApiModelProperty(required = false, value = "")
@JsonProperty("id")
public Long getId() { public Long getId() {
return id; return id;
} }
@@ -42,7 +30,10 @@ public class User {
} }
/**
**/
@ApiModelProperty(required = false, value = "") @ApiModelProperty(required = false, value = "")
@JsonProperty("username")
public String getUsername() { public String getUsername() {
return username; return username;
} }
@@ -51,7 +42,10 @@ public class User {
} }
/**
**/
@ApiModelProperty(required = false, value = "") @ApiModelProperty(required = false, value = "")
@JsonProperty("firstName")
public String getFirstName() { public String getFirstName() {
return firstName; return firstName;
} }
@@ -60,7 +54,10 @@ public class User {
} }
/**
**/
@ApiModelProperty(required = false, value = "") @ApiModelProperty(required = false, value = "")
@JsonProperty("lastName")
public String getLastName() { public String getLastName() {
return lastName; return lastName;
} }
@@ -69,7 +66,10 @@ public class User {
} }
/**
**/
@ApiModelProperty(required = false, value = "") @ApiModelProperty(required = false, value = "")
@JsonProperty("email")
public String getEmail() { public String getEmail() {
return email; return email;
} }
@@ -78,7 +78,10 @@ public class User {
} }
/**
**/
@ApiModelProperty(required = false, value = "") @ApiModelProperty(required = false, value = "")
@JsonProperty("password")
public String getPassword() { public String getPassword() {
return password; return password;
} }
@@ -87,7 +90,10 @@ public class User {
} }
/**
**/
@ApiModelProperty(required = false, value = "") @ApiModelProperty(required = false, value = "")
@JsonProperty("phone")
public String getPhone() { public String getPhone() {
return phone; return phone;
} }
@@ -96,7 +102,11 @@ public class User {
} }
/**
* User Status
**/
@ApiModelProperty(required = false, value = "User Status") @ApiModelProperty(required = false, value = "User Status")
@JsonProperty("userStatus")
public Integer getUserStatus() { public Integer getUserStatus() {
return userStatus; return userStatus;
} }