Merge pull request #1815 from wing328/java_server_fix_import

[Java] To fix missing imports in inline models in server templates
This commit is contained in:
wing328 2016-01-05 17:06:36 +08:00
commit 0635c60cf1
46 changed files with 667 additions and 186 deletions

9
bin/java-petstore-all.sh Executable file
View File

@ -0,0 +1,9 @@
#!/bin/sh
# update java petstore for all supported http libraries
./bin/java-petstore.sh
./bin/java-petstore-jersey2.sh
./bin/java-petstore-feign.sh
./bin/java-petstore-okhttp-gson.sh
./bin/java-petstore-retrofit.sh
./bin/java-petstore-retrofit2.sh

View File

@ -1,5 +1,6 @@
package {{package}};
import java.util.Objects;
{{#imports}}import {{import}};
{{/imports}}

View File

@ -1,5 +1,6 @@
package {{package}};
import java.util.Objects;
{{#imports}}import {{import}};
{{/imports}}

View File

@ -13,7 +13,7 @@ import io.swagger.model.*;
import io.swagger.model.Pet;
import java.io.File;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2015-11-30T10:22:45.081-08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2016-01-05T14:57:33.884+08:00")
public class PetController {
/**
* Uncomment and implement as you see fit. These operations will map

View File

@ -13,7 +13,7 @@ import io.swagger.model.*;
import java.util.Map;
import io.swagger.model.Order;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2015-11-30T10:22:45.081-08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2016-01-05T14:57:33.884+08:00")
public class StoreController {
/**
* Uncomment and implement as you see fit. These operations will map

View File

@ -13,7 +13,7 @@ import io.swagger.model.*;
import io.swagger.model.User;
import java.util.*;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2015-11-30T10:22:45.081-08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2016-01-05T14:57:33.884+08:00")
public class UserController {
/**
* Uncomment and implement as you see fit. These operations will map

View File

@ -1,13 +1,17 @@
package io.swagger.model;
import io.swagger.annotations.*;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ApiModel(description = "")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2015-11-30T10:22:45.081-08:00")
public class Category {
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2016-01-05T14:57:33.884+08:00")
public class Category {
private Long id = null;
private String name = null;
@ -15,6 +19,7 @@ public class Category {
/**
**/
@ApiModelProperty(value = "")
@JsonProperty("id")
public Long getId() {
@ -27,6 +32,7 @@ public class Category {
/**
**/
@ApiModelProperty(value = "")
@JsonProperty("name")
public String getName() {
@ -39,13 +45,43 @@ public class Category {
@Override
public String toString() {
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Category category = (Category) o;
return Objects.equals(id, category.id) &&
Objects.equals(name, category.name);
}
@Override
public int hashCode() {
return Objects.hash(id, name);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Category {\n");
sb.append(" id: ").append(id).append("\n");
sb.append(" name: ").append(name).append("\n");
sb.append("}\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@ -1,28 +1,50 @@
package io.swagger.model;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
import io.swagger.annotations.*;
import com.fasterxml.jackson.annotation.JsonProperty;
@ApiModel(description = "")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2015-11-30T10:22:45.081-08:00")
public class Order {
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2016-01-05T14:57:33.884+08:00")
public class Order {
private Long id = null;
private Long petId = null;
private Integer quantity = null;
private Date shipDate = null;
public enum StatusEnum {
placed, approved, delivered,
};
PLACED("placed"),
APPROVED("approved"),
DELIVERED("delivered");
private String value;
StatusEnum(String value) {
this.value = value;
}
@Override
@JsonValue
public String toString() {
return value;
}
}
private StatusEnum status = null;
private Boolean complete = null;
/**
**/
@ApiModelProperty(value = "")
@JsonProperty("id")
public Long getId() {
@ -35,6 +57,7 @@ public class Order {
/**
**/
@ApiModelProperty(value = "")
@JsonProperty("petId")
public Long getPetId() {
@ -47,6 +70,7 @@ public class Order {
/**
**/
@ApiModelProperty(value = "")
@JsonProperty("quantity")
public Integer getQuantity() {
@ -59,6 +83,7 @@ public class Order {
/**
**/
@ApiModelProperty(value = "")
@JsonProperty("shipDate")
public Date getShipDate() {
@ -72,6 +97,7 @@ public class Order {
/**
* Order Status
**/
@ApiModelProperty(value = "Order Status")
@JsonProperty("status")
public StatusEnum getStatus() {
@ -84,6 +110,7 @@ public class Order {
/**
**/
@ApiModelProperty(value = "")
@JsonProperty("complete")
public Boolean getComplete() {
@ -96,17 +123,51 @@ public class Order {
@Override
public String toString() {
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Order order = (Order) o;
return Objects.equals(id, order.id) &&
Objects.equals(petId, order.petId) &&
Objects.equals(quantity, order.quantity) &&
Objects.equals(shipDate, order.shipDate) &&
Objects.equals(status, order.status) &&
Objects.equals(complete, order.complete);
}
@Override
public int hashCode() {
return Objects.hash(id, petId, quantity, shipDate, status, complete);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Order {\n");
sb.append(" id: ").append(id).append("\n");
sb.append(" petId: ").append(petId).append("\n");
sb.append(" quantity: ").append(quantity).append("\n");
sb.append(" shipDate: ").append(shipDate).append("\n");
sb.append(" status: ").append(status).append("\n");
sb.append(" complete: ").append(complete).append("\n");
sb.append("}\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" petId: ").append(toIndentedString(petId)).append("\n");
sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n");
sb.append(" shipDate: ").append(toIndentedString(shipDate)).append("\n");
sb.append(" status: ").append(toIndentedString(status)).append("\n");
sb.append(" complete: ").append(toIndentedString(complete)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@ -1,30 +1,52 @@
package io.swagger.model;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.model.Category;
import io.swagger.model.Tag;
import java.util.*;
import io.swagger.annotations.*;
import com.fasterxml.jackson.annotation.JsonProperty;
@ApiModel(description = "")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2015-11-30T10:22:45.081-08:00")
public class Pet {
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2016-01-05T14:57:33.884+08:00")
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,
};
AVAILABLE("available"),
PENDING("pending"),
SOLD("sold");
private String value;
StatusEnum(String value) {
this.value = value;
}
@Override
@JsonValue
public String toString() {
return value;
}
}
private StatusEnum status = null;
/**
**/
@ApiModelProperty(value = "")
@JsonProperty("id")
public Long getId() {
@ -37,6 +59,7 @@ public class Pet {
/**
**/
@ApiModelProperty(value = "")
@JsonProperty("category")
public Category getCategory() {
@ -49,6 +72,7 @@ public class Pet {
/**
**/
@ApiModelProperty(required = true, value = "")
@JsonProperty("name")
public String getName() {
@ -61,6 +85,7 @@ public class Pet {
/**
**/
@ApiModelProperty(required = true, value = "")
@JsonProperty("photoUrls")
public List<String> getPhotoUrls() {
@ -73,6 +98,7 @@ public class Pet {
/**
**/
@ApiModelProperty(value = "")
@JsonProperty("tags")
public List<Tag> getTags() {
@ -86,6 +112,7 @@ public class Pet {
/**
* pet status in the store
**/
@ApiModelProperty(value = "pet status in the store")
@JsonProperty("status")
public StatusEnum getStatus() {
@ -98,17 +125,51 @@ public class Pet {
@Override
public String toString() {
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Pet pet = (Pet) o;
return Objects.equals(id, pet.id) &&
Objects.equals(category, pet.category) &&
Objects.equals(name, pet.name) &&
Objects.equals(photoUrls, pet.photoUrls) &&
Objects.equals(tags, pet.tags) &&
Objects.equals(status, pet.status);
}
@Override
public int hashCode() {
return Objects.hash(id, category, name, photoUrls, tags, status);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Pet {\n");
sb.append(" id: ").append(id).append("\n");
sb.append(" category: ").append(category).append("\n");
sb.append(" name: ").append(name).append("\n");
sb.append(" photoUrls: ").append(photoUrls).append("\n");
sb.append(" tags: ").append(tags).append("\n");
sb.append(" status: ").append(status).append("\n");
sb.append("}\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" category: ").append(toIndentedString(category)).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append(" photoUrls: ").append(toIndentedString(photoUrls)).append("\n");
sb.append(" tags: ").append(toIndentedString(tags)).append("\n");
sb.append(" status: ").append(toIndentedString(status)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@ -1,13 +1,17 @@
package io.swagger.model;
import io.swagger.annotations.*;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ApiModel(description = "")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2015-11-30T10:22:45.081-08:00")
public class Tag {
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2016-01-05T14:57:33.884+08:00")
public class Tag {
private Long id = null;
private String name = null;
@ -15,6 +19,7 @@ public class Tag {
/**
**/
@ApiModelProperty(value = "")
@JsonProperty("id")
public Long getId() {
@ -27,6 +32,7 @@ public class Tag {
/**
**/
@ApiModelProperty(value = "")
@JsonProperty("name")
public String getName() {
@ -39,13 +45,43 @@ public class Tag {
@Override
public String toString() {
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Tag tag = (Tag) o;
return Objects.equals(id, tag.id) &&
Objects.equals(name, tag.name);
}
@Override
public int hashCode() {
return Objects.hash(id, name);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Tag {\n");
sb.append(" id: ").append(id).append("\n");
sb.append(" name: ").append(name).append("\n");
sb.append("}\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@ -1,13 +1,17 @@
package io.swagger.model;
import io.swagger.annotations.*;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ApiModel(description = "")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2015-11-30T10:22:45.081-08:00")
public class User {
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2016-01-05T14:57:33.884+08:00")
public class User {
private Long id = null;
private String username = null;
@ -21,6 +25,7 @@ public class User {
/**
**/
@ApiModelProperty(value = "")
@JsonProperty("id")
public Long getId() {
@ -33,6 +38,7 @@ public class User {
/**
**/
@ApiModelProperty(value = "")
@JsonProperty("username")
public String getUsername() {
@ -45,6 +51,7 @@ public class User {
/**
**/
@ApiModelProperty(value = "")
@JsonProperty("firstName")
public String getFirstName() {
@ -57,6 +64,7 @@ public class User {
/**
**/
@ApiModelProperty(value = "")
@JsonProperty("lastName")
public String getLastName() {
@ -69,6 +77,7 @@ public class User {
/**
**/
@ApiModelProperty(value = "")
@JsonProperty("email")
public String getEmail() {
@ -81,6 +90,7 @@ public class User {
/**
**/
@ApiModelProperty(value = "")
@JsonProperty("password")
public String getPassword() {
@ -93,6 +103,7 @@ public class User {
/**
**/
@ApiModelProperty(value = "")
@JsonProperty("phone")
public String getPhone() {
@ -106,6 +117,7 @@ public class User {
/**
* User Status
**/
@ApiModelProperty(value = "User Status")
@JsonProperty("userStatus")
public Integer getUserStatus() {
@ -118,19 +130,55 @@ public class User {
@Override
public String toString() {
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
User user = (User) o;
return Objects.equals(id, user.id) &&
Objects.equals(username, user.username) &&
Objects.equals(firstName, user.firstName) &&
Objects.equals(lastName, user.lastName) &&
Objects.equals(email, user.email) &&
Objects.equals(password, user.password) &&
Objects.equals(phone, user.phone) &&
Objects.equals(userStatus, user.userStatus);
}
@Override
public int hashCode() {
return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class User {\n");
sb.append(" id: ").append(id).append("\n");
sb.append(" username: ").append(username).append("\n");
sb.append(" firstName: ").append(firstName).append("\n");
sb.append(" lastName: ").append(lastName).append("\n");
sb.append(" email: ").append(email).append("\n");
sb.append(" password: ").append(password).append("\n");
sb.append(" phone: ").append(phone).append("\n");
sb.append(" userStatus: ").append(userStatus).append("\n");
sb.append("}\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" username: ").append(toIndentedString(username)).append("\n");
sb.append(" firstName: ").append(toIndentedString(firstName)).append("\n");
sb.append(" lastName: ").append(toIndentedString(lastName)).append("\n");
sb.append(" email: ").append(toIndentedString(email)).append("\n");
sb.append(" password: ").append(toIndentedString(password)).append("\n");
sb.append(" phone: ").append(toIndentedString(phone)).append("\n");
sb.append(" userStatus: ").append(toIndentedString(userStatus)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@ -45,6 +45,8 @@ paths:
- petstore_auth:
- "write:pets"
- "read:pets"
x-contentType: "application/json"
x-accepts: "application/json"
put:
tags:
- "pet"
@ -75,6 +77,8 @@ paths:
- petstore_auth:
- "write:pets"
- "read:pets"
x-contentType: "application/json"
x-accepts: "application/json"
/pet/findByStatus:
get:
tags:
@ -108,6 +112,8 @@ paths:
- petstore_auth:
- "write:pets"
- "read:pets"
x-contentType: "application/json"
x-accepts: "application/json"
/pet/findByTags:
get:
tags:
@ -141,6 +147,8 @@ paths:
- petstore_auth:
- "write:pets"
- "read:pets"
x-contentType: "application/json"
x-accepts: "application/json"
/pet/{petId}:
get:
tags:
@ -173,6 +181,8 @@ paths:
- petstore_auth:
- "write:pets"
- "read:pets"
x-contentType: "application/json"
x-accepts: "application/json"
post:
tags:
- "pet"
@ -207,6 +217,8 @@ paths:
- petstore_auth:
- "write:pets"
- "read:pets"
x-contentType: "application/x-www-form-urlencoded"
x-accepts: "application/json"
delete:
tags:
- "pet"
@ -235,6 +247,8 @@ paths:
- petstore_auth:
- "write:pets"
- "read:pets"
x-contentType: "application/json"
x-accepts: "application/json"
/pet/{petId}/uploadImage:
post:
tags:
@ -271,6 +285,8 @@ paths:
- petstore_auth:
- "write:pets"
- "read:pets"
x-contentType: "multipart/form-data"
x-accepts: "application/json"
/store/inventory:
get:
tags:
@ -292,6 +308,8 @@ paths:
format: "int32"
security:
- api_key: []
x-contentType: "application/json"
x-accepts: "application/json"
/store/order:
post:
tags:
@ -316,6 +334,8 @@ paths:
$ref: "#/definitions/Order"
400:
description: "Invalid Order"
x-contentType: "application/json"
x-accepts: "application/json"
/store/order/{orderId}:
get:
tags:
@ -342,6 +362,8 @@ paths:
description: "Invalid ID supplied"
404:
description: "Order not found"
x-contentType: "application/json"
x-accepts: "application/json"
delete:
tags:
- "store"
@ -363,6 +385,8 @@ paths:
description: "Invalid ID supplied"
404:
description: "Order not found"
x-contentType: "application/json"
x-accepts: "application/json"
/user:
post:
tags:
@ -383,6 +407,8 @@ paths:
responses:
default:
description: "successful operation"
x-contentType: "application/json"
x-accepts: "application/json"
/user/createWithArray:
post:
tags:
@ -405,6 +431,8 @@ paths:
responses:
default:
description: "successful operation"
x-contentType: "application/json"
x-accepts: "application/json"
/user/createWithList:
post:
tags:
@ -427,6 +455,8 @@ paths:
responses:
default:
description: "successful operation"
x-contentType: "application/json"
x-accepts: "application/json"
/user/login:
get:
tags:
@ -455,6 +485,8 @@ paths:
type: "string"
400:
description: "Invalid username/password supplied"
x-contentType: "application/json"
x-accepts: "application/json"
/user/logout:
get:
tags:
@ -469,6 +501,8 @@ paths:
responses:
default:
description: "successful operation"
x-contentType: "application/json"
x-accepts: "application/json"
/user/{username}:
get:
tags:
@ -504,6 +538,8 @@ paths:
description: "Invalid username supplied"
404:
description: "User not found"
x-contentType: "application/json"
x-accepts: "application/json"
put:
tags:
- "user"
@ -530,6 +566,8 @@ paths:
description: "Invalid user supplied"
404:
description: "User not found"
x-contentType: "application/json"
x-accepts: "application/json"
delete:
tags:
- "user"
@ -550,6 +588,8 @@ paths:
description: "Invalid username supplied"
404:
description: "User not found"
x-contentType: "application/json"
x-accepts: "application/json"
securityDefinitions:
api_key:
type: "apiKey"

View File

@ -2,7 +2,7 @@
## Overview
This server was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. By using the
[swagger-spec](https://github.com/swagger-api/swagger-core/wiki) from a remote server, you can easily generate a server stub. This
[OpenAPI-Spec](https://github.com/swagger-api/swagger-core/wiki) from a remote server, you can easily generate a server stub. This
is an example of building a swagger-enabled JAX-RS server.
This example uses the [JAX-RS](https://jax-rs-spec.java.net/) framework.

View File

@ -1,6 +1,6 @@
package io.swagger.api;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-12-01T23:25:59.622+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2016-01-05T15:00:28.637+08:00")
public class ApiException extends Exception{
private int code;
public ApiException (int code, String msg) {

View File

@ -5,7 +5,7 @@ import java.io.IOException;
import javax.servlet.*;
import javax.servlet.http.HttpServletResponse;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-12-01T23:25:59.622+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2016-01-05T15:00:28.637+08:00")
public class ApiOriginFilter implements javax.servlet.Filter {
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {

View File

@ -3,7 +3,7 @@ package io.swagger.api;
import javax.xml.bind.annotation.XmlTransient;
@javax.xml.bind.annotation.XmlRootElement
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-12-01T23:25:59.622+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2016-01-05T15:00:28.637+08:00")
public class ApiResponseMessage {
public static final int ERROR = 1;
public static final int WARNING = 2;

View File

@ -1,6 +1,6 @@
package io.swagger.api;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-12-01T23:25:59.622+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2016-01-05T15:00:28.637+08:00")
public class NotFoundException extends ApiException {
private int code;
public NotFoundException (int code, String msg) {

View File

@ -28,7 +28,7 @@ import javax.ws.rs.*;
@io.swagger.annotations.Api(description = "the pet API")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-12-01T23:25:59.622+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2016-01-05T15:00:28.637+08:00")
public class PetApi {
private final PetApiService delegate = PetApiServiceFactory.getPetApi();

View File

@ -19,7 +19,7 @@ import com.sun.jersey.multipart.FormDataParam;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.SecurityContext;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-12-01T23:25:59.622+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2016-01-05T15:00:28.637+08:00")
public abstract class PetApiService {
public abstract Response updatePet(Pet body,SecurityContext securityContext)

View File

@ -28,7 +28,7 @@ import javax.ws.rs.*;
@io.swagger.annotations.Api(description = "the store API")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-12-01T23:25:59.622+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2016-01-05T15:00:28.637+08:00")
public class StoreApi {
private final StoreApiService delegate = StoreApiServiceFactory.getStoreApi();

View File

@ -19,7 +19,7 @@ import com.sun.jersey.multipart.FormDataParam;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.SecurityContext;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-12-01T23:25:59.622+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2016-01-05T15:00:28.637+08:00")
public abstract class StoreApiService {
public abstract Response getInventory(SecurityContext securityContext)

View File

@ -28,7 +28,7 @@ import javax.ws.rs.*;
@io.swagger.annotations.Api(description = "the user API")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-12-01T23:25:59.622+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2016-01-05T15:00:28.637+08:00")
public class UserApi {
private final UserApiService delegate = UserApiServiceFactory.getUserApi();

View File

@ -19,7 +19,7 @@ import com.sun.jersey.multipart.FormDataParam;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.SecurityContext;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-12-01T23:25:59.622+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2016-01-05T15:00:28.637+08:00")
public abstract class UserApiService {
public abstract Response createUser(User body,SecurityContext securityContext)

View File

@ -1,15 +1,17 @@
package io.swagger.model;
import io.swagger.annotations.*;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ApiModel(description = "")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-12-01T23:25:59.622+08:00")
public class Category {
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2016-01-05T15:00:28.637+08:00")
public class Category {
private Long id = null;
private String name = null;
@ -17,6 +19,7 @@ public class Category {
/**
**/
@ApiModelProperty(value = "")
@JsonProperty("id")
public Long getId() {
@ -29,6 +32,7 @@ public class Category {
/**
**/
@ApiModelProperty(value = "")
@JsonProperty("name")
public String getName() {
@ -59,13 +63,25 @@ public class Category {
}
@Override
public String toString() {
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Category {\n");
sb.append(" id: ").append(id).append("\n");
sb.append(" name: ").append(name).append("\n");
sb.append("}\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@ -1,30 +1,50 @@
package io.swagger.model;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
import io.swagger.annotations.*;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Objects;
@ApiModel(description = "")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-12-01T23:25:59.622+08:00")
public class Order {
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2016-01-05T15:00:28.637+08:00")
public class Order {
private Long id = null;
private Long petId = null;
private Integer quantity = null;
private Date shipDate = null;
public enum StatusEnum {
placed, approved, delivered,
};
PLACED("placed"),
APPROVED("approved"),
DELIVERED("delivered");
private String value;
StatusEnum(String value) {
this.value = value;
}
@Override
@JsonValue
public String toString() {
return value;
}
}
private StatusEnum status = null;
private Boolean complete = null;
/**
**/
@ApiModelProperty(value = "")
@JsonProperty("id")
public Long getId() {
@ -37,6 +57,7 @@ public class Order {
/**
**/
@ApiModelProperty(value = "")
@JsonProperty("petId")
public Long getPetId() {
@ -49,6 +70,7 @@ public class Order {
/**
**/
@ApiModelProperty(value = "")
@JsonProperty("quantity")
public Integer getQuantity() {
@ -61,6 +83,7 @@ public class Order {
/**
**/
@ApiModelProperty(value = "")
@JsonProperty("shipDate")
public Date getShipDate() {
@ -74,6 +97,7 @@ public class Order {
/**
* Order Status
**/
@ApiModelProperty(value = "Order Status")
@JsonProperty("status")
public StatusEnum getStatus() {
@ -86,6 +110,7 @@ public class Order {
/**
**/
@ApiModelProperty(value = "")
@JsonProperty("complete")
public Boolean getComplete() {
@ -120,17 +145,29 @@ public class Order {
}
@Override
public String toString() {
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Order {\n");
sb.append(" id: ").append(id).append("\n");
sb.append(" petId: ").append(petId).append("\n");
sb.append(" quantity: ").append(quantity).append("\n");
sb.append(" shipDate: ").append(shipDate).append("\n");
sb.append(" status: ").append(status).append("\n");
sb.append(" complete: ").append(complete).append("\n");
sb.append("}\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" petId: ").append(toIndentedString(petId)).append("\n");
sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n");
sb.append(" shipDate: ").append(toIndentedString(shipDate)).append("\n");
sb.append(" status: ").append(toIndentedString(status)).append("\n");
sb.append(" complete: ").append(toIndentedString(complete)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@ -1,32 +1,52 @@
package io.swagger.model;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.model.Category;
import io.swagger.model.Tag;
import java.util.*;
import io.swagger.annotations.*;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Objects;
@ApiModel(description = "")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-12-01T23:25:59.622+08:00")
public class Pet {
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2016-01-05T15:00:28.637+08:00")
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,
};
AVAILABLE("available"),
PENDING("pending"),
SOLD("sold");
private String value;
StatusEnum(String value) {
this.value = value;
}
@Override
@JsonValue
public String toString() {
return value;
}
}
private StatusEnum status = null;
/**
**/
@ApiModelProperty(value = "")
@JsonProperty("id")
public Long getId() {
@ -39,6 +59,7 @@ public class Pet {
/**
**/
@ApiModelProperty(value = "")
@JsonProperty("category")
public Category getCategory() {
@ -51,6 +72,7 @@ public class Pet {
/**
**/
@ApiModelProperty(required = true, value = "")
@JsonProperty("name")
public String getName() {
@ -63,6 +85,7 @@ public class Pet {
/**
**/
@ApiModelProperty(required = true, value = "")
@JsonProperty("photoUrls")
public List<String> getPhotoUrls() {
@ -75,6 +98,7 @@ public class Pet {
/**
**/
@ApiModelProperty(value = "")
@JsonProperty("tags")
public List<Tag> getTags() {
@ -88,6 +112,7 @@ public class Pet {
/**
* pet status in the store
**/
@ApiModelProperty(value = "pet status in the store")
@JsonProperty("status")
public StatusEnum getStatus() {
@ -122,17 +147,29 @@ public class Pet {
}
@Override
public String toString() {
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Pet {\n");
sb.append(" id: ").append(id).append("\n");
sb.append(" category: ").append(category).append("\n");
sb.append(" name: ").append(name).append("\n");
sb.append(" photoUrls: ").append(photoUrls).append("\n");
sb.append(" tags: ").append(tags).append("\n");
sb.append(" status: ").append(status).append("\n");
sb.append("}\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" category: ").append(toIndentedString(category)).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append(" photoUrls: ").append(toIndentedString(photoUrls)).append("\n");
sb.append(" tags: ").append(toIndentedString(tags)).append("\n");
sb.append(" status: ").append(toIndentedString(status)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@ -1,15 +1,17 @@
package io.swagger.model;
import io.swagger.annotations.*;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ApiModel(description = "")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-12-01T23:25:59.622+08:00")
public class Tag {
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2016-01-05T15:00:28.637+08:00")
public class Tag {
private Long id = null;
private String name = null;
@ -17,6 +19,7 @@ public class Tag {
/**
**/
@ApiModelProperty(value = "")
@JsonProperty("id")
public Long getId() {
@ -29,6 +32,7 @@ public class Tag {
/**
**/
@ApiModelProperty(value = "")
@JsonProperty("name")
public String getName() {
@ -59,13 +63,25 @@ public class Tag {
}
@Override
public String toString() {
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Tag {\n");
sb.append(" id: ").append(id).append("\n");
sb.append(" name: ").append(name).append("\n");
sb.append("}\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@ -1,15 +1,17 @@
package io.swagger.model;
import io.swagger.annotations.*;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ApiModel(description = "")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-12-01T23:25:59.622+08:00")
public class User {
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2016-01-05T15:00:28.637+08:00")
public class User {
private Long id = null;
private String username = null;
@ -23,6 +25,7 @@ public class User {
/**
**/
@ApiModelProperty(value = "")
@JsonProperty("id")
public Long getId() {
@ -35,6 +38,7 @@ public class User {
/**
**/
@ApiModelProperty(value = "")
@JsonProperty("username")
public String getUsername() {
@ -47,6 +51,7 @@ public class User {
/**
**/
@ApiModelProperty(value = "")
@JsonProperty("firstName")
public String getFirstName() {
@ -59,6 +64,7 @@ public class User {
/**
**/
@ApiModelProperty(value = "")
@JsonProperty("lastName")
public String getLastName() {
@ -71,6 +77,7 @@ public class User {
/**
**/
@ApiModelProperty(value = "")
@JsonProperty("email")
public String getEmail() {
@ -83,6 +90,7 @@ public class User {
/**
**/
@ApiModelProperty(value = "")
@JsonProperty("password")
public String getPassword() {
@ -95,6 +103,7 @@ public class User {
/**
**/
@ApiModelProperty(value = "")
@JsonProperty("phone")
public String getPhone() {
@ -108,6 +117,7 @@ public class User {
/**
* User Status
**/
@ApiModelProperty(value = "User Status")
@JsonProperty("userStatus")
public Integer getUserStatus() {
@ -144,19 +154,31 @@ public class User {
}
@Override
public String toString() {
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class User {\n");
sb.append(" id: ").append(id).append("\n");
sb.append(" username: ").append(username).append("\n");
sb.append(" firstName: ").append(firstName).append("\n");
sb.append(" lastName: ").append(lastName).append("\n");
sb.append(" email: ").append(email).append("\n");
sb.append(" password: ").append(password).append("\n");
sb.append(" phone: ").append(phone).append("\n");
sb.append(" userStatus: ").append(userStatus).append("\n");
sb.append("}\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" username: ").append(toIndentedString(username)).append("\n");
sb.append(" firstName: ").append(toIndentedString(firstName)).append("\n");
sb.append(" lastName: ").append(toIndentedString(lastName)).append("\n");
sb.append(" email: ").append(toIndentedString(email)).append("\n");
sb.append(" password: ").append(toIndentedString(password)).append("\n");
sb.append(" phone: ").append(toIndentedString(phone)).append("\n");
sb.append(" userStatus: ").append(toIndentedString(userStatus)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@ -4,7 +4,7 @@ Spring MVC Server
## Overview
This server was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. By using the [swagger-spec](https://github.com/swagger-api/swagger-core), you can easily generate a server stub. This is an example of building a swagger-enabled server in Java using the Spring MVC framework.
This server was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. By using the [OpenAPI-Spec](https://github.com/swagger-api/swagger-core), you can easily generate a server stub. This is an example of building a swagger-enabled server in Java using the Spring MVC framework.
The underlying library integrating swagger to Spring-MVC is [springfox](https://github.com/springfox/springfox)

View File

@ -150,7 +150,7 @@
</repository>
</repositories>
<properties>
<swagger-core-version>1.5.3</swagger-core-version>
<swagger-core-version>1.5.4</swagger-core-version>
<jetty-version>9.2.9.v20150224</jetty-version>
<jersey-version>1.13</jersey-version>
<slf4j-version>1.6.3</slf4j-version>

View File

@ -1,6 +1,6 @@
package io.swagger.api;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2015-10-20T10:58:42.063-07:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-01-05T15:01:20.501+08:00")
public class ApiException extends Exception{
private int code;
public ApiException (int code, String msg) {

View File

@ -5,7 +5,7 @@ import java.io.IOException;
import javax.servlet.*;
import javax.servlet.http.HttpServletResponse;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2015-10-20T10:58:42.063-07:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-01-05T15:01:20.501+08:00")
public class ApiOriginFilter implements javax.servlet.Filter {
@Override
public void doFilter(ServletRequest request, ServletResponse response,

View File

@ -3,7 +3,7 @@ package io.swagger.api;
import javax.xml.bind.annotation.XmlTransient;
@javax.xml.bind.annotation.XmlRootElement
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2015-10-20T10:58:42.063-07:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-01-05T15:01:20.501+08:00")
public class ApiResponseMessage {
public static final int ERROR = 1;
public static final int WARNING = 2;

View File

@ -1,6 +1,6 @@
package io.swagger.api;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2015-10-20T10:58:42.063-07:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-01-05T15:01:20.501+08:00")
public class NotFoundException extends ApiException {
private int code;
public NotFoundException (int code, String msg) {

View File

@ -32,11 +32,16 @@ import static org.springframework.http.MediaType.*;
@Controller
@RequestMapping(value = "/pet", produces = {APPLICATION_JSON_VALUE})
@Api(value = "/pet", description = "the pet API")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2015-10-20T10:58:42.063-07:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-01-05T15:01:20.501+08:00")
public class PetApi {
@ApiOperation(value = "Update an existing pet", notes = "", response = Void.class)
@ApiOperation(value = "Update an existing pet", notes = "", response = Void.class, authorizations = {
@Authorization(value = "petstore_auth", scopes = {
@AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
@AuthorizationScope(scope = "read:pets", description = "read your pets")
})
})
@ApiResponses(value = {
@ApiResponse(code = 400, message = "Invalid ID supplied"),
@ApiResponse(code = 404, message = "Pet not found"),
@ -47,7 +52,7 @@ public class PetApi {
method = RequestMethod.PUT)
public ResponseEntity<Void> updatePet(
@ApiParam(value = "Pet object that needs to be added to the store" ) Pet body
@ApiParam(value = "Pet object that needs to be added to the store" ) @RequestBody Pet body
)
throws NotFoundException {
// do some magic!
@ -56,7 +61,12 @@ public class PetApi {
@ApiOperation(value = "Add a new pet to the store", notes = "", response = Void.class)
@ApiOperation(value = "Add a new pet to the store", notes = "", response = Void.class, authorizations = {
@Authorization(value = "petstore_auth", scopes = {
@AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
@AuthorizationScope(scope = "read:pets", description = "read your pets")
})
})
@ApiResponses(value = {
@ApiResponse(code = 405, message = "Invalid input") })
@RequestMapping(value = "",
@ -65,7 +75,7 @@ public class PetApi {
method = RequestMethod.POST)
public ResponseEntity<Void> addPet(
@ApiParam(value = "Pet object that needs to be added to the store" ) Pet body
@ApiParam(value = "Pet object that needs to be added to the store" ) @RequestBody Pet body
)
throws NotFoundException {
// do some magic!
@ -74,7 +84,12 @@ public class PetApi {
@ApiOperation(value = "Finds Pets by status", notes = "Multiple status values can be provided with comma seperated strings", response = Pet.class, responseContainer = "List")
@ApiOperation(value = "Finds Pets by status", notes = "Multiple status values can be provided with comma seperated strings", response = Pet.class, responseContainer = "List", authorizations = {
@Authorization(value = "petstore_auth", scopes = {
@AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
@AuthorizationScope(scope = "read:pets", description = "read your pets")
})
})
@ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation"),
@ApiResponse(code = 400, message = "Invalid status value") })
@ -93,7 +108,12 @@ public class PetApi {
@ApiOperation(value = "Finds Pets by tags", notes = "Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.", response = Pet.class, responseContainer = "List")
@ApiOperation(value = "Finds Pets by tags", notes = "Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.", response = Pet.class, responseContainer = "List", authorizations = {
@Authorization(value = "petstore_auth", scopes = {
@AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
@AuthorizationScope(scope = "read:pets", description = "read your pets")
})
})
@ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation"),
@ApiResponse(code = 400, message = "Invalid tag value") })
@ -112,7 +132,9 @@ public class PetApi {
@ApiOperation(value = "Find pet by ID", notes = "Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions", response = Pet.class)
@ApiOperation(value = "Find pet by ID", notes = "Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions", response = Pet.class, authorizations = {
@Authorization(value = "api_key")
})
@ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation"),
@ApiResponse(code = 400, message = "Invalid ID supplied"),
@ -132,7 +154,12 @@ public class PetApi {
@ApiOperation(value = "Updates a pet in the store with form data", notes = "", response = Void.class)
@ApiOperation(value = "Updates a pet in the store with form data", notes = "", response = Void.class, authorizations = {
@Authorization(value = "petstore_auth", scopes = {
@AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
@AuthorizationScope(scope = "read:pets", description = "read your pets")
})
})
@ApiResponses(value = {
@ApiResponse(code = 405, message = "Invalid input") })
@RequestMapping(value = "/{petId}",
@ -160,7 +187,12 @@ public class PetApi {
@ApiOperation(value = "Deletes a pet", notes = "", response = Void.class)
@ApiOperation(value = "Deletes a pet", notes = "", response = Void.class, authorizations = {
@Authorization(value = "petstore_auth", scopes = {
@AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
@AuthorizationScope(scope = "read:pets", description = "read your pets")
})
})
@ApiResponses(value = {
@ApiResponse(code = 400, message = "Invalid pet value") })
@RequestMapping(value = "/{petId}",
@ -182,7 +214,12 @@ public class PetApi {
@ApiOperation(value = "uploads an image", notes = "", response = Void.class)
@ApiOperation(value = "uploads an image", notes = "", response = Void.class, authorizations = {
@Authorization(value = "petstore_auth", scopes = {
@AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
@AuthorizationScope(scope = "read:pets", description = "read your pets")
})
})
@ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation") })
@RequestMapping(value = "/{petId}/uploadImage",

View File

@ -32,11 +32,13 @@ import static org.springframework.http.MediaType.*;
@Controller
@RequestMapping(value = "/store", produces = {APPLICATION_JSON_VALUE})
@Api(value = "/store", description = "the store API")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2015-10-20T10:58:42.063-07:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-01-05T15:01:20.501+08:00")
public class StoreApi {
@ApiOperation(value = "Returns pet inventories by status", notes = "Returns a map of status codes to quantities", response = Integer.class, responseContainer = "Map")
@ApiOperation(value = "Returns pet inventories by status", notes = "Returns a map of status codes to quantities", response = Integer.class, responseContainer = "Map", authorizations = {
@Authorization(value = "api_key")
})
@ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation") })
@RequestMapping(value = "/inventory",
@ -61,7 +63,7 @@ public class StoreApi {
method = RequestMethod.POST)
public ResponseEntity<Order> placeOrder(
@ApiParam(value = "order placed for purchasing the pet" ) Order body
@ApiParam(value = "order placed for purchasing the pet" ) @RequestBody Order body
)
throws NotFoundException {
// do some magic!

View File

@ -32,7 +32,7 @@ import static org.springframework.http.MediaType.*;
@Controller
@RequestMapping(value = "/user", produces = {APPLICATION_JSON_VALUE})
@Api(value = "/user", description = "the user API")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2015-10-20T10:58:42.063-07:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-01-05T15:01:20.501+08:00")
public class UserApi {
@ -45,7 +45,7 @@ public class UserApi {
method = RequestMethod.POST)
public ResponseEntity<Void> createUser(
@ApiParam(value = "Created user object" ) User body
@ApiParam(value = "Created user object" ) @RequestBody User body
)
throws NotFoundException {
// do some magic!
@ -63,7 +63,7 @@ public class UserApi {
method = RequestMethod.POST)
public ResponseEntity<Void> createUsersWithArrayInput(
@ApiParam(value = "List of user object" ) List<User> body
@ApiParam(value = "List of user object" ) @RequestBody List<User> body
)
throws NotFoundException {
// do some magic!
@ -81,7 +81,7 @@ public class UserApi {
method = RequestMethod.POST)
public ResponseEntity<Void> createUsersWithListInput(
@ApiParam(value = "List of user object" ) List<User> body
@ApiParam(value = "List of user object" ) @RequestBody List<User> body
)
throws NotFoundException {
// do some magic!
@ -162,7 +162,7 @@ public class UserApi {
,
@ApiParam(value = "Updated user object" ) User body
@ApiParam(value = "Updated user object" ) @RequestBody User body
)
throws NotFoundException {
// do some magic!

View File

@ -18,11 +18,11 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
@EnableSwagger2 //Loads the spring beans required by the framework
@PropertySource("classpath:swagger.properties")
@Import(SwaggerUiConfiguration.class)
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2015-10-20T10:58:42.063-07:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-01-05T15:01:20.501+08:00")
public class SwaggerConfig {
@Bean
ApiInfo apiInfo() {
return new ApiInfo(
ApiInfo apiInfo = new ApiInfo(
"Swagger Petstore",
"This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters",
"1.0.0",
@ -30,6 +30,7 @@ public class SwaggerConfig {
"apiteam@swagger.io",
"Apache 2.0",
"http://www.apache.org/licenses/LICENSE-2.0.html" );
return apiInfo;
}
@Bean

View File

@ -8,7 +8,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
@Configuration
@EnableWebMvc
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2015-10-20T10:58:42.063-07:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-01-05T15:01:20.501+08:00")
public class SwaggerUiConfiguration extends WebMvcConfigurerAdapter {
private static final String[] SERVLET_RESOURCE_LOCATIONS = { "/" };

View File

@ -2,7 +2,7 @@ package io.swagger.configuration;
import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2015-10-20T10:58:42.063-07:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-01-05T15:01:20.501+08:00")
public class WebApplication extends AbstractAnnotationConfigDispatcherServletInitializer {
@Override

View File

@ -3,7 +3,7 @@ package io.swagger.configuration;
import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2015-10-20T10:58:42.063-07:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-01-05T15:01:20.501+08:00")
public class WebMvcConfiguration extends WebMvcConfigurationSupport {
@Override
public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) {

View File

@ -1,5 +1,9 @@
package io.swagger.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.*;
import com.fasterxml.jackson.annotation.JsonProperty;
@ -8,7 +12,7 @@ import java.util.Objects;
@ApiModel(description = "")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2015-11-24T12:32:52.703+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-01-05T15:01:20.501+08:00")
public class Category {
private Long id = null;

View File

@ -1,5 +1,9 @@
package io.swagger.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
import io.swagger.annotations.*;
@ -9,7 +13,7 @@ import java.util.Objects;
@ApiModel(description = "")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2015-11-24T12:32:52.703+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-01-05T15:01:20.501+08:00")
public class Order {
private Long id = null;

View File

@ -1,8 +1,12 @@
package io.swagger.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.model.Category;
import java.util.*;
import io.swagger.model.Tag;
import java.util.*;
import io.swagger.annotations.*;
import com.fasterxml.jackson.annotation.JsonProperty;
@ -11,7 +15,7 @@ import java.util.Objects;
@ApiModel(description = "")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2015-11-24T12:32:52.703+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-01-05T15:01:20.501+08:00")
public class Pet {
private Long id = null;

View File

@ -1,5 +1,9 @@
package io.swagger.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.*;
import com.fasterxml.jackson.annotation.JsonProperty;
@ -8,7 +12,7 @@ import java.util.Objects;
@ApiModel(description = "")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2015-11-24T12:32:52.703+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-01-05T15:01:20.501+08:00")
public class Tag {
private Long id = null;

View File

@ -1,5 +1,9 @@
package io.swagger.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.*;
import com.fasterxml.jackson.annotation.JsonProperty;
@ -8,7 +12,7 @@ import java.util.Objects;
@ApiModel(description = "")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2015-11-24T12:32:52.703+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-01-05T15:01:20.501+08:00")
public class User {
private Long id = null;