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

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>
</div>

View File

@@ -152,7 +152,8 @@ public class PetApi {
@ApiOperation(value = "uploads an image", notes = "", response = Void.class)
@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 detail") @FormDataParam("file") FormDataContentDisposition fileDetail)
throws NotFoundException {

View File

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

View File

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

View File

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

View File

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

View File

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