update sample for jaxrs

This commit is contained in:
wing328 2016-04-15 18:18:18 +08:00
parent d64751958e
commit 400cc9e6f9
32 changed files with 75 additions and 212 deletions

View File

@ -1,6 +1,6 @@
package io.swagger.api;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-16T14:27:58.108+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-15T18:10:39.667+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.JavaResteasyServerCodegen", date = "2016-03-16T14:27:58.108+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-15T18:10:39.667+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.JavaResteasyServerCodegen", date = "2016-03-16T14:27:58.108+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-15T18:10:39.667+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.JavaResteasyServerCodegen", date = "2016-03-16T14:27:58.108+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-15T18:10:39.667+08:00")
public class NotFoundException extends ApiException {
private int code;
public NotFoundException (int code, String msg) {

View File

@ -5,7 +5,7 @@ import io.swagger.api.PetApiService;
import io.swagger.api.factories.PetApiServiceFactory;
import io.swagger.model.Pet;
import io.swagger.model.InlineResponse200;
import io.swagger.model.ApiResponse;
import java.io.File;
import java.util.List;
@ -22,14 +22,14 @@ import org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataInput;
@Path("/pet")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-16T14:27:58.108+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-15T18:10:39.667+08:00")
public class PetApi {
private final PetApiService delegate = PetApiServiceFactory.getPetApi();
@POST
@Consumes({ "application/json", "application/xml" })
@Produces({ "application/json", "application/xml" })
@Produces({ "application/xml", "application/json" })
public Response addPet( Pet body,@Context SecurityContext securityContext)
throws NotFoundException {
return delegate.addPet(body,securityContext);
@ -37,7 +37,7 @@ public class PetApi {
@DELETE
@Path("/{petId}")
@Produces({ "application/json", "application/xml" })
@Produces({ "application/xml", "application/json" })
public Response deletePet( @PathParam("petId") Long petId,@HeaderParam("api_key") String apiKey,@Context SecurityContext securityContext)
throws NotFoundException {
return delegate.deletePet(petId,apiKey,securityContext);
@ -45,7 +45,7 @@ public class PetApi {
@GET
@Path("/findByStatus")
@Produces({ "application/json", "application/xml" })
@Produces({ "application/xml", "application/json" })
public Response findPetsByStatus( @QueryParam("status") List<String> status,@Context SecurityContext securityContext)
throws NotFoundException {
return delegate.findPetsByStatus(status,securityContext);
@ -53,7 +53,7 @@ public class PetApi {
@GET
@Path("/findByTags")
@Produces({ "application/json", "application/xml" })
@Produces({ "application/xml", "application/json" })
public Response findPetsByTags( @QueryParam("tags") List<String> tags,@Context SecurityContext securityContext)
throws NotFoundException {
return delegate.findPetsByTags(tags,securityContext);
@ -61,31 +61,15 @@ public class PetApi {
@GET
@Path("/{petId}")
@Produces({ "application/json", "application/xml" })
@Produces({ "application/xml", "application/json" })
public Response getPetById( @PathParam("petId") Long petId,@Context SecurityContext securityContext)
throws NotFoundException {
return delegate.getPetById(petId,securityContext);
}
@GET
@Path("/{petId}?response=inline_arbitrary_object")
@Produces({ "application/json", "application/xml" })
public Response getPetByIdInObject( @PathParam("petId") Long petId,@Context SecurityContext securityContext)
throws NotFoundException {
return delegate.getPetByIdInObject(petId,securityContext);
}
@GET
@Path("/{petId}?testing_byte_array=true")
@Produces({ "application/json", "application/xml" })
public Response petPetIdtestingByteArraytrueGet( @PathParam("petId") Long petId,@Context SecurityContext securityContext)
throws NotFoundException {
return delegate.petPetIdtestingByteArraytrueGet(petId,securityContext);
}
@PUT
@Consumes({ "application/json", "application/xml" })
@Produces({ "application/json", "application/xml" })
@Produces({ "application/xml", "application/json" })
public Response updatePet( Pet body,@Context SecurityContext securityContext)
throws NotFoundException {
return delegate.updatePet(body,securityContext);
@ -93,15 +77,15 @@ public class PetApi {
@POST
@Path("/{petId}")
@Consumes({ "application/x-www-form-urlencoded" })
@Produces({ "application/json", "application/xml" })
public Response updatePetWithForm( @PathParam("petId") String petId,@FormParam("name") String name,@FormParam("status") String status,@Context SecurityContext securityContext)
@Produces({ "application/xml", "application/json" })
public Response updatePetWithForm( @PathParam("petId") Long petId,@FormParam("name") String name,@FormParam("status") String status,@Context SecurityContext securityContext)
throws NotFoundException {
return delegate.updatePetWithForm(petId,name,status,securityContext);
}
@POST
@Path("/{petId}/uploadImage")
@Consumes({ "multipart/form-data" })
@Produces({ "application/json", "application/xml" })
@Produces({ "application/json" })
public Response uploadFile(MultipartFormDataInput input, @PathParam("petId") Long petId,@Context SecurityContext securityContext)
throws NotFoundException {
return delegate.uploadFile(input,petId,securityContext);

View File

@ -6,7 +6,7 @@ import org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataInput;
import io.swagger.model.Pet;
import io.swagger.model.InlineResponse200;
import io.swagger.model.ApiResponse;
import java.io.File;
import java.util.List;
@ -17,37 +17,22 @@ import java.io.InputStream;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.SecurityContext;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-16T14:27:58.108+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-15T18:10:39.667+08:00")
public abstract class PetApiService {
public abstract Response addPet(Pet body,SecurityContext securityContext)
throws NotFoundException;
public abstract Response deletePet(Long petId,String apiKey,SecurityContext securityContext)
throws NotFoundException;
public abstract Response findPetsByStatus(List<String> status,SecurityContext securityContext)
throws NotFoundException;
public abstract Response findPetsByTags(List<String> tags,SecurityContext securityContext)
throws NotFoundException;
public abstract Response getPetById(Long petId,SecurityContext securityContext)
throws NotFoundException;
public abstract Response getPetByIdInObject(Long petId,SecurityContext securityContext)
throws NotFoundException;
public abstract Response petPetIdtestingByteArraytrueGet(Long petId,SecurityContext securityContext)
throws NotFoundException;
public abstract Response updatePet(Pet body,SecurityContext securityContext)
throws NotFoundException;
public abstract Response updatePetWithForm(String petId,String name,String status,SecurityContext securityContext)
public abstract Response updatePetWithForm(Long petId,String name,String status,SecurityContext securityContext)
throws NotFoundException;
public abstract Response uploadFile(MultipartFormDataInput input,Long petId,SecurityContext securityContext)
throws NotFoundException;
}

View File

@ -4,8 +4,8 @@ import io.swagger.model.*;
import io.swagger.api.StoreApiService;
import io.swagger.api.factories.StoreApiServiceFactory;
import io.swagger.model.Order;
import java.util.Map;
import io.swagger.model.Order;
import java.util.List;
import io.swagger.api.NotFoundException;
@ -20,54 +20,38 @@ import javax.ws.rs.*;
@Path("/store")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-16T14:27:58.108+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-15T18:10:39.667+08:00")
public class StoreApi {
private final StoreApiService delegate = StoreApiServiceFactory.getStoreApi();
@DELETE
@Path("/order/{orderId}")
@Produces({ "application/json", "application/xml" })
@Produces({ "application/xml", "application/json" })
public Response deleteOrder( @PathParam("orderId") String orderId,@Context SecurityContext securityContext)
throws NotFoundException {
return delegate.deleteOrder(orderId,securityContext);
}
@GET
@Path("/findByStatus")
@Produces({ "application/json", "application/xml" })
public Response findOrdersByStatus( @QueryParam("status") String status,@Context SecurityContext securityContext)
throws NotFoundException {
return delegate.findOrdersByStatus(status,securityContext);
}
@GET
@Path("/inventory")
@Produces({ "application/json", "application/xml" })
@Produces({ "application/json" })
public Response getInventory(@Context SecurityContext securityContext)
throws NotFoundException {
return delegate.getInventory(securityContext);
}
@GET
@Path("/inventory?response=arbitrary_object")
@Produces({ "application/json", "application/xml" })
public Response getInventoryInObject(@Context SecurityContext securityContext)
throws NotFoundException {
return delegate.getInventoryInObject(securityContext);
}
@GET
@Path("/order/{orderId}")
@Produces({ "application/json", "application/xml" })
public Response getOrderById( @PathParam("orderId") String orderId,@Context SecurityContext securityContext)
@Produces({ "application/xml", "application/json" })
public Response getOrderById( @PathParam("orderId") Long orderId,@Context SecurityContext securityContext)
throws NotFoundException {
return delegate.getOrderById(orderId,securityContext);
}
@POST
@Path("/order")
@Produces({ "application/json", "application/xml" })
@Produces({ "application/xml", "application/json" })
public Response placeOrder( Order body,@Context SecurityContext securityContext)
throws NotFoundException {
return delegate.placeOrder(body,securityContext);

View File

@ -4,8 +4,8 @@ import io.swagger.api.*;
import io.swagger.model.*;
import io.swagger.model.Order;
import java.util.Map;
import io.swagger.model.Order;
import java.util.List;
import io.swagger.api.NotFoundException;
@ -15,25 +15,14 @@ import java.io.InputStream;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.SecurityContext;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-16T14:27:58.108+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-15T18:10:39.667+08:00")
public abstract class StoreApiService {
public abstract Response deleteOrder(String orderId,SecurityContext securityContext)
throws NotFoundException;
public abstract Response findOrdersByStatus(String status,SecurityContext securityContext)
throws NotFoundException;
public abstract Response getInventory(SecurityContext securityContext)
throws NotFoundException;
public abstract Response getInventoryInObject(SecurityContext securityContext)
public abstract Response getOrderById(Long orderId,SecurityContext securityContext)
throws NotFoundException;
public abstract Response getOrderById(String orderId,SecurityContext securityContext)
throws NotFoundException;
public abstract Response placeOrder(Order body,SecurityContext securityContext)
throws NotFoundException;
}

View File

@ -1,6 +1,6 @@
package io.swagger.api;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-16T14:27:58.108+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-15T18:10:39.667+08:00")
public class StringUtil {
/**
* Check if the given array contains the given value (with case-insensitive comparison).

View File

@ -20,14 +20,14 @@ import javax.ws.rs.*;
@Path("/user")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-16T14:27:58.108+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-15T18:10:39.667+08:00")
public class UserApi {
private final UserApiService delegate = UserApiServiceFactory.getUserApi();
@POST
@Produces({ "application/json", "application/xml" })
@Produces({ "application/xml", "application/json" })
public Response createUser( User body,@Context SecurityContext securityContext)
throws NotFoundException {
return delegate.createUser(body,securityContext);
@ -35,7 +35,7 @@ public class UserApi {
@POST
@Path("/createWithArray")
@Produces({ "application/json", "application/xml" })
@Produces({ "application/xml", "application/json" })
public Response createUsersWithArrayInput( List<User> body,@Context SecurityContext securityContext)
throws NotFoundException {
return delegate.createUsersWithArrayInput(body,securityContext);
@ -43,7 +43,7 @@ public class UserApi {
@POST
@Path("/createWithList")
@Produces({ "application/json", "application/xml" })
@Produces({ "application/xml", "application/json" })
public Response createUsersWithListInput( List<User> body,@Context SecurityContext securityContext)
throws NotFoundException {
return delegate.createUsersWithListInput(body,securityContext);
@ -51,7 +51,7 @@ public class UserApi {
@DELETE
@Path("/{username}")
@Produces({ "application/json", "application/xml" })
@Produces({ "application/xml", "application/json" })
public Response deleteUser( @PathParam("username") String username,@Context SecurityContext securityContext)
throws NotFoundException {
return delegate.deleteUser(username,securityContext);
@ -59,7 +59,7 @@ public class UserApi {
@GET
@Path("/{username}")
@Produces({ "application/json", "application/xml" })
@Produces({ "application/xml", "application/json" })
public Response getUserByName( @PathParam("username") String username,@Context SecurityContext securityContext)
throws NotFoundException {
return delegate.getUserByName(username,securityContext);
@ -67,7 +67,7 @@ public class UserApi {
@GET
@Path("/login")
@Produces({ "application/json", "application/xml" })
@Produces({ "application/xml", "application/json" })
public Response loginUser( @QueryParam("username") String username, @QueryParam("password") String password,@Context SecurityContext securityContext)
throws NotFoundException {
return delegate.loginUser(username,password,securityContext);
@ -75,7 +75,7 @@ public class UserApi {
@GET
@Path("/logout")
@Produces({ "application/json", "application/xml" })
@Produces({ "application/xml", "application/json" })
public Response logoutUser(@Context SecurityContext securityContext)
throws NotFoundException {
return delegate.logoutUser(securityContext);
@ -83,7 +83,7 @@ public class UserApi {
@PUT
@Path("/{username}")
@Produces({ "application/json", "application/xml" })
@Produces({ "application/xml", "application/json" })
public Response updateUser( @PathParam("username") String username, User body,@Context SecurityContext securityContext)
throws NotFoundException {
return delegate.updateUser(username,body,securityContext);

View File

@ -15,31 +15,22 @@ import java.io.InputStream;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.SecurityContext;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-16T14:27:58.108+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-15T18:10:39.667+08:00")
public abstract class UserApiService {
public abstract Response createUser(User body,SecurityContext securityContext)
throws NotFoundException;
public abstract Response createUsersWithArrayInput(List<User> body,SecurityContext securityContext)
throws NotFoundException;
public abstract Response createUsersWithListInput(List<User> body,SecurityContext securityContext)
throws NotFoundException;
public abstract Response deleteUser(String username,SecurityContext securityContext)
throws NotFoundException;
public abstract Response getUserByName(String username,SecurityContext securityContext)
throws NotFoundException;
public abstract Response loginUser(String username,String password,SecurityContext securityContext)
throws NotFoundException;
public abstract Response logoutUser(SecurityContext securityContext)
throws NotFoundException;
public abstract Response updateUser(String username,User body,SecurityContext securityContext)
throws NotFoundException;
}

View File

@ -8,13 +8,12 @@ import com.fasterxml.jackson.annotation.JsonValue;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-16T14:27:58.108+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-15T18:10:39.667+08:00")
public class Category {
private Long id = null;
private String name = null;
/**
**/
@ -26,7 +25,6 @@ public class Category {
this.id = id;
}
/**
**/
@ -38,7 +36,6 @@ public class Category {
this.name = name;
}
@Override
public boolean equals(Object o) {

View File

@ -9,7 +9,7 @@ import java.util.Date;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-16T14:27:58.108+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-15T18:10:39.667+08:00")
public class Order {
private Long id = null;
@ -37,9 +37,8 @@ public class Order {
}
private StatusEnum status = null;
private Boolean complete = null;
private Boolean complete = false;
/**
**/
@ -51,7 +50,6 @@ public class Order {
this.id = id;
}
/**
**/
@ -63,7 +61,6 @@ public class Order {
this.petId = petId;
}
/**
**/
@ -75,7 +72,6 @@ public class Order {
this.quantity = quantity;
}
/**
**/
@ -87,7 +83,6 @@ public class Order {
this.shipDate = shipDate;
}
/**
* Order Status
**/
@ -100,7 +95,6 @@ public class Order {
this.status = status;
}
/**
**/
@ -112,7 +106,6 @@ public class Order {
this.complete = complete;
}
@Override
public boolean equals(Object o) {

View File

@ -11,7 +11,7 @@ import java.util.List;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-16T14:27:58.108+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-15T18:10:39.667+08:00")
public class Pet {
private Long id = null;
@ -41,7 +41,6 @@ public class Pet {
private StatusEnum status = null;
/**
**/
@ -53,7 +52,6 @@ public class Pet {
this.id = id;
}
/**
**/
@ -65,7 +63,6 @@ public class Pet {
this.category = category;
}
/**
**/
@ -77,7 +74,6 @@ public class Pet {
this.name = name;
}
/**
**/
@ -89,7 +85,6 @@ public class Pet {
this.photoUrls = photoUrls;
}
/**
**/
@ -101,7 +96,6 @@ public class Pet {
this.tags = tags;
}
/**
* pet status in the store
**/
@ -114,7 +108,6 @@ public class Pet {
this.status = status;
}
@Override
public boolean equals(Object o) {

View File

@ -8,13 +8,12 @@ import com.fasterxml.jackson.annotation.JsonValue;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-16T14:27:58.108+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-15T18:10:39.667+08:00")
public class Tag {
private Long id = null;
private String name = null;
/**
**/
@ -26,7 +25,6 @@ public class Tag {
this.id = id;
}
/**
**/
@ -38,7 +36,6 @@ public class Tag {
this.name = name;
}
@Override
public boolean equals(Object o) {

View File

@ -8,7 +8,7 @@ import com.fasterxml.jackson.annotation.JsonValue;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-16T14:27:58.108+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-15T18:10:39.667+08:00")
public class User {
private Long id = null;
@ -20,7 +20,6 @@ public class User {
private String phone = null;
private Integer userStatus = null;
/**
**/
@ -32,7 +31,6 @@ public class User {
this.id = id;
}
/**
**/
@ -44,7 +42,6 @@ public class User {
this.username = username;
}
/**
**/
@ -56,7 +53,6 @@ public class User {
this.firstName = firstName;
}
/**
**/
@ -68,7 +64,6 @@ public class User {
this.lastName = lastName;
}
/**
**/
@ -80,7 +75,6 @@ public class User {
this.email = email;
}
/**
**/
@ -92,7 +86,6 @@ public class User {
this.password = password;
}
/**
**/
@ -104,7 +97,6 @@ public class User {
this.phone = phone;
}
/**
* User Status
**/
@ -117,7 +109,6 @@ public class User {
this.userStatus = userStatus;
}
@Override
public boolean equals(Object o) {

View File

@ -51,14 +51,18 @@ public class PetApiServiceImpl extends PetApiService {
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
}
/*
* comment out as the method (for testing) does not exit in the original swagger spec
* we'll uncomment this code block later if we update the petstore server
@Override
public Response getPetByIdInObject(Long petId,SecurityContext securityContext) throws NotFoundException {
// do some magic!
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
}
*/
@Override
public Response updatePetWithForm(String petId,String name,String status,SecurityContext securityContext) throws NotFoundException {
public Response updatePetWithForm(Long petId,String name,String status,SecurityContext securityContext) throws NotFoundException {
// do some magic!
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
}
@ -75,11 +79,15 @@ public class PetApiServiceImpl extends PetApiService {
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
}
/*
* comment out as the method (for testing) does not exit in the original swagger spec
* we'll uncomment this code block later if we update the petstore server
@Override
public Response petPetIdtestingByteArraytrueGet(Long petId,SecurityContext securityContext) throws NotFoundException {
// do some magic!
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
}
*/
}

View File

@ -26,11 +26,15 @@ public class StoreApiServiceImpl extends StoreApiService {
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
}
/*
* * comment out as the method (for testing) does not exit in the original swagger spec
* * we'll uncomment this code block later if we update the petstore server
@Override
public Response getInventoryInObject(SecurityContext securityContext) throws NotFoundException {
// do some magic!
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
}
*/
@Override
public Response placeOrder(Order body,SecurityContext securityContext) throws NotFoundException {
@ -39,7 +43,7 @@ public class StoreApiServiceImpl extends StoreApiService {
}
@Override
public Response getOrderById(String orderId,SecurityContext securityContext) throws NotFoundException {
public Response getOrderById(Long orderId,SecurityContext securityContext) throws NotFoundException {
// do some magic!
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
}
@ -50,11 +54,15 @@ public class StoreApiServiceImpl extends StoreApiService {
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
}
/*
* * comment out as the method (for testing) does not exit in the original swagger spec
* * we'll uncomment this code block later if we update the petstore server
@Override
public Response findOrdersByStatus(String status, SecurityContext securityContext) throws NotFoundException {
// do some magic!
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
}
*/
}

View File

@ -62,8 +62,7 @@ public class PetApi {
})
}, tags={ "pet", })
@io.swagger.annotations.ApiResponses(value = {
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = void.class),
@io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found", response = void.class) })
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid pet value", response = void.class) })
public Response deletePet(
@ApiParam(value = "Pet id to delete",required=true) @PathParam("petId") Long petId,
@ApiParam(value = "" )@HeaderParam("api_key") String apiKey,
@ -94,7 +93,7 @@ public class PetApi {
@Path("/findByTags")
@Produces({ "application/xml", "application/json" })
@io.swagger.annotations.ApiOperation(value = "Finds Pets by tags", notes = "Muliple tags can be provided with comma separated strings. Use\ntag1, tag2, tag3 for testing.\n", response = Pet.class, responseContainer = "List", authorizations = {
@io.swagger.annotations.ApiOperation(value = "Finds Pets by tags", notes = "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.", response = Pet.class, responseContainer = "List", authorizations = {
@io.swagger.annotations.Authorization(value = "petstore_auth", scopes = {
@io.swagger.annotations.AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
@io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets")
@ -150,7 +149,7 @@ public class PetApi {
@Path("/{petId}")
@Consumes({ "application/x-www-form-urlencoded" })
@Produces({ "application/xml", "application/json" })
@io.swagger.annotations.ApiOperation(value = "Updates a pet in the store with form data", notes = "null", response = void.class, authorizations = {
@io.swagger.annotations.ApiOperation(value = "Updates a pet in the store with form data", notes = "", response = void.class, authorizations = {
@io.swagger.annotations.Authorization(value = "petstore_auth", scopes = {
@io.swagger.annotations.AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
@io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets")

View File

@ -22,29 +22,20 @@ import javax.ws.rs.core.SecurityContext;
public abstract class PetApiService {
public abstract Response addPet(Pet body,SecurityContext securityContext)
throws NotFoundException;
public abstract Response deletePet(Long petId,String apiKey,SecurityContext securityContext)
throws NotFoundException;
public abstract Response findPetsByStatus(List<String> status,SecurityContext securityContext)
throws NotFoundException;
public abstract Response findPetsByTags(List<String> tags,SecurityContext securityContext)
throws NotFoundException;
public abstract Response getPetById(Long petId,SecurityContext securityContext)
throws NotFoundException;
public abstract Response updatePet(Pet body,SecurityContext securityContext)
throws NotFoundException;
public abstract Response updatePetWithForm(Long petId,String name,String status,SecurityContext securityContext)
throws NotFoundException;
public abstract Response uploadFile(Long petId,String additionalMetadata,InputStream inputStream, FormDataContentDisposition fileDetail,SecurityContext securityContext)
throws NotFoundException;
}

View File

@ -36,12 +36,12 @@ public class StoreApi {
@Path("/order/{orderId}")
@Produces({ "application/xml", "application/json" })
@io.swagger.annotations.ApiOperation(value = "Delete purchase order by ID", notes = "For valid response try integer IDs with positive integer value.\\ \\ Negative or non-integer values will generate API errors", response = void.class, tags={ "store", })
@io.swagger.annotations.ApiOperation(value = "Delete purchase order by ID", notes = "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors", response = void.class, tags={ "store", })
@io.swagger.annotations.ApiResponses(value = {
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = void.class),
@io.swagger.annotations.ApiResponse(code = 404, message = "Order not found", response = void.class) })
public Response deleteOrder(
@ApiParam(value = "ID of the order that needs to be deleted",required=true) @PathParam("orderId") Long orderId,
@ApiParam(value = "ID of the order that needs to be deleted",required=true) @PathParam("orderId") String orderId,
@Context SecurityContext securityContext)
throws NotFoundException {
return delegate.deleteOrder(orderId,securityContext);
@ -64,7 +64,7 @@ public class StoreApi {
@Path("/order/{orderId}")
@Produces({ "application/xml", "application/json" })
@io.swagger.annotations.ApiOperation(value = "Find purchase order by ID", notes = "For valid response try integer IDs with value >= 1 and <= 10.\nOther values will generated exceptions\n", response = Order.class, tags={ "store", })
@io.swagger.annotations.ApiOperation(value = "Find purchase order by ID", notes = "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions", response = Order.class, tags={ "store", })
@io.swagger.annotations.ApiResponses(value = {
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Order.class),
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = Order.class),

View File

@ -21,17 +21,12 @@ import javax.ws.rs.core.SecurityContext;
public abstract class StoreApiService {
public abstract Response deleteOrder(Long orderId,SecurityContext securityContext)
public abstract Response deleteOrder(String orderId,SecurityContext securityContext)
throws NotFoundException;
public abstract Response getInventory(SecurityContext securityContext)
throws NotFoundException;
public abstract Response getOrderById(Long orderId,SecurityContext securityContext)
throws NotFoundException;
public abstract Response placeOrder(Order body,SecurityContext securityContext)
throws NotFoundException;
}

View File

@ -95,7 +95,7 @@ public class UserApi {
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid username supplied", response = User.class),
@io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = User.class) })
public Response getUserByName(
@ApiParam(value = "The name that needs to be fetched. Use user1 for testing.",required=true) @PathParam("username") String username,
@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true) @PathParam("username") String username,
@Context SecurityContext securityContext)
throws NotFoundException {
return delegate.getUserByName(username,securityContext);
@ -119,7 +119,7 @@ public class UserApi {
@Path("/logout")
@Produces({ "application/xml", "application/json" })
@io.swagger.annotations.ApiOperation(value = "Logs out current logged in user session", notes = "null", response = void.class, tags={ "user", })
@io.swagger.annotations.ApiOperation(value = "Logs out current logged in user session", notes = "", response = void.class, tags={ "user", })
@io.swagger.annotations.ApiResponses(value = {
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = void.class) })
public Response logoutUser(
@ -136,7 +136,7 @@ public class UserApi {
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid user supplied", response = void.class),
@io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = void.class) })
public Response updateUser(
@ApiParam(value = "name that need to be updated",required=true) @PathParam("username") String username,
@ApiParam(value = "name that need to be deleted",required=true) @PathParam("username") String username,
@ApiParam(value = "Updated user object" ,required=true) User body,
@Context SecurityContext securityContext)
throws NotFoundException {

View File

@ -21,29 +21,20 @@ import javax.ws.rs.core.SecurityContext;
public abstract class UserApiService {
public abstract Response createUser(User body,SecurityContext securityContext)
throws NotFoundException;
public abstract Response createUsersWithArrayInput(List<User> body,SecurityContext securityContext)
throws NotFoundException;
public abstract Response createUsersWithListInput(List<User> body,SecurityContext securityContext)
throws NotFoundException;
public abstract Response deleteUser(String username,SecurityContext securityContext)
throws NotFoundException;
public abstract Response getUserByName(String username,SecurityContext securityContext)
throws NotFoundException;
public abstract Response loginUser(String username,String password,SecurityContext securityContext)
throws NotFoundException;
public abstract Response logoutUser(SecurityContext securityContext)
throws NotFoundException;
public abstract Response updateUser(String username,User body,SecurityContext securityContext)
throws NotFoundException;
}

View File

@ -16,7 +16,6 @@ public class ApiResponse {
private String type = null;
private String message = null;
/**
**/
public ApiResponse code(Integer code) {
@ -34,7 +33,6 @@ public class ApiResponse {
this.code = code;
}
/**
**/
public ApiResponse type(String type) {
@ -52,7 +50,6 @@ public class ApiResponse {
this.type = type;
}
/**
**/
public ApiResponse message(String message) {
@ -70,7 +67,6 @@ public class ApiResponse {
this.message = message;
}
@Override
public boolean equals(Object o) {

View File

@ -15,7 +15,6 @@ public class Category {
private Long id = null;
private String name = null;
/**
**/
public Category id(Long id) {
@ -33,7 +32,6 @@ public class Category {
this.id = id;
}
/**
**/
public Category name(String name) {
@ -51,7 +49,6 @@ public class Category {
this.name = name;
}
@Override
public boolean equals(Object o) {

View File

@ -41,7 +41,6 @@ public class Order {
private StatusEnum status = null;
private Boolean complete = false;
/**
**/
public Order id(Long id) {
@ -59,7 +58,6 @@ public class Order {
this.id = id;
}
/**
**/
public Order petId(Long petId) {
@ -77,7 +75,6 @@ public class Order {
this.petId = petId;
}
/**
**/
public Order quantity(Integer quantity) {
@ -95,7 +92,6 @@ public class Order {
this.quantity = quantity;
}
/**
**/
public Order shipDate(Date shipDate) {
@ -113,7 +109,6 @@ public class Order {
this.shipDate = shipDate;
}
/**
* Order Status
**/
@ -132,7 +127,6 @@ public class Order {
this.status = status;
}
/**
**/
public Order complete(Boolean complete) {
@ -150,7 +144,6 @@ public class Order {
this.complete = complete;
}
@Override
public boolean equals(Object o) {

View File

@ -44,7 +44,6 @@ public class Pet {
private StatusEnum status = null;
/**
**/
public Pet id(Long id) {
@ -62,7 +61,6 @@ public class Pet {
this.id = id;
}
/**
**/
public Pet category(Category category) {
@ -80,7 +78,6 @@ public class Pet {
this.category = category;
}
/**
**/
public Pet name(String name) {
@ -98,7 +95,6 @@ public class Pet {
this.name = name;
}
/**
**/
public Pet photoUrls(List<String> photoUrls) {
@ -116,7 +112,6 @@ public class Pet {
this.photoUrls = photoUrls;
}
/**
**/
public Pet tags(List<Tag> tags) {
@ -134,7 +129,6 @@ public class Pet {
this.tags = tags;
}
/**
* pet status in the store
**/
@ -153,7 +147,6 @@ public class Pet {
this.status = status;
}
@Override
public boolean equals(Object o) {

View File

@ -15,7 +15,6 @@ public class Tag {
private Long id = null;
private String name = null;
/**
**/
public Tag id(Long id) {
@ -33,7 +32,6 @@ public class Tag {
this.id = id;
}
/**
**/
public Tag name(String name) {
@ -51,7 +49,6 @@ public class Tag {
this.name = name;
}
@Override
public boolean equals(Object o) {

View File

@ -21,7 +21,6 @@ public class User {
private String phone = null;
private Integer userStatus = null;
/**
**/
public User id(Long id) {
@ -39,7 +38,6 @@ public class User {
this.id = id;
}
/**
**/
public User username(String username) {
@ -57,7 +55,6 @@ public class User {
this.username = username;
}
/**
**/
public User firstName(String firstName) {
@ -75,7 +72,6 @@ public class User {
this.firstName = firstName;
}
/**
**/
public User lastName(String lastName) {
@ -93,7 +89,6 @@ public class User {
this.lastName = lastName;
}
/**
**/
public User email(String email) {
@ -111,7 +106,6 @@ public class User {
this.email = email;
}
/**
**/
public User password(String password) {
@ -129,7 +123,6 @@ public class User {
this.password = password;
}
/**
**/
public User phone(String phone) {
@ -147,7 +140,6 @@ public class User {
this.phone = phone;
}
/**
* User Status
**/
@ -166,7 +158,6 @@ public class User {
this.userStatus = userStatus;
}
@Override
public boolean equals(Object o) {

View File

@ -15,7 +15,7 @@ public class Bootstrap extends HttpServlet {
public void init(ServletConfig config) throws ServletException {
Info info = new Info()
.title("Swagger Server")
.description("This is a sample server Petstore server. You can find out more about\nSwagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/).\nFor this sample, you can use the api key `special-key` to test the authorization filters.\n")
.description("This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.")
.termsOfService("http://swagger.io/terms/")
.contact(new Contact()
.email("apiteam@swagger.io"))

View File

@ -23,7 +23,7 @@ import javax.ws.rs.core.SecurityContext;
public class StoreApiServiceImpl extends StoreApiService {
@Override
public Response deleteOrder(Long orderId, SecurityContext securityContext)
public Response deleteOrder(String orderId, SecurityContext securityContext)
throws NotFoundException {
// do some magic!
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();