mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-07 10:58:55 +00:00
Update pet store for Jaxrs
This commit is contained in:
parent
c2a001847f
commit
b439bf020e
@ -1,6 +1,6 @@
|
||||
package io.swagger.api;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2016-01-05T15:00:28.637+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2016-01-14T20:53:59.204Z")
|
||||
public class ApiException extends Exception{
|
||||
private int code;
|
||||
public ApiException (int code, String msg) {
|
||||
|
@ -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 = "2016-01-05T15:00:28.637+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2016-01-14T20:53:59.204Z")
|
||||
public class ApiOriginFilter implements javax.servlet.Filter {
|
||||
public void doFilter(ServletRequest request, ServletResponse response,
|
||||
FilterChain chain) throws IOException, ServletException {
|
||||
|
@ -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 = "2016-01-05T15:00:28.637+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2016-01-14T20:53:59.204Z")
|
||||
public class ApiResponseMessage {
|
||||
public static final int ERROR = 1;
|
||||
public static final int WARNING = 2;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package io.swagger.api;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2016-01-05T15:00:28.637+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2016-01-14T20:53:59.204Z")
|
||||
public class NotFoundException extends ApiException {
|
||||
private int code;
|
||||
public NotFoundException (int code, String msg) {
|
||||
|
@ -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 = "2016-01-05T15:00:28.637+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2016-01-14T20:53:59.204Z")
|
||||
public class PetApi {
|
||||
private final PetApiService delegate = PetApiServiceFactory.getPetApi();
|
||||
|
||||
@ -169,13 +169,31 @@ public class PetApi {
|
||||
@io.swagger.annotations.AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
||||
@io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets")
|
||||
})
|
||||
}, tags={ "pet" })
|
||||
}, tags={ "pet", })
|
||||
@io.swagger.annotations.ApiResponses(value = {
|
||||
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) })
|
||||
|
||||
public Response uploadFile(@ApiParam(value = "ID of pet to update",required=true) @PathParam("petId") Long petId,@ApiParam(value = "Additional data to pass to server")@FormParam("additionalMetadata") String additionalMetadata, @FormDataParam("file") InputStream inputStream,
|
||||
@FormDataParam("file") FormDataContentDisposition fileDetail,@Context SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
return delegate.uploadFile(petId,additionalMetadata,fileDetail,securityContext);
|
||||
return delegate.uploadFile(petId,additionalMetadata,inputStream, fileDetail,securityContext);
|
||||
}
|
||||
@GET
|
||||
@Path("/{petId}?testing_byte_array=true")
|
||||
|
||||
@Produces({ "application/json", "application/xml" })
|
||||
@io.swagger.annotations.ApiOperation(value = "Fake endpoint to test byte array return by 'Find pet by ID'", notes = "Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions", response = byte[].class, authorizations = {
|
||||
@io.swagger.annotations.Authorization(value = "api_key")
|
||||
}, tags={ "pet" })
|
||||
@io.swagger.annotations.ApiResponses(value = {
|
||||
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = byte[].class),
|
||||
|
||||
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = byte[].class),
|
||||
|
||||
@io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found", response = byte[].class) })
|
||||
|
||||
public Response getPetByIdWithByteArray(@ApiParam(value = "ID of pet that needs to be fetched",required=true) @PathParam("petId") Long petId,@Context SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
return delegate.getPetByIdWithByteArray(petId,securityContext);
|
||||
}
|
||||
}
|
||||
|
@ -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 = "2016-01-05T15:00:28.637+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2016-01-14T20:53:59.204Z")
|
||||
public abstract class PetApiService {
|
||||
|
||||
public abstract Response updatePet(Pet body,SecurityContext securityContext)
|
||||
@ -43,7 +43,10 @@ public abstract class PetApiService {
|
||||
public abstract Response deletePet(Long petId,String apiKey,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
|
||||
public abstract Response uploadFile(Long petId,String additionalMetadata,FormDataContentDisposition fileDetail,SecurityContext securityContext)
|
||||
public abstract Response uploadFile(Long petId,String additionalMetadata,InputStream inputStream, FormDataContentDisposition fileDetail,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
|
||||
public abstract Response getPetByIdWithByteArray(Long petId,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,50 @@
|
||||
package io.swagger.api;
|
||||
|
||||
import io.swagger.model.*;
|
||||
import io.swagger.api.PettestingByteArraytrueApiService;
|
||||
import io.swagger.api.factories.PettestingByteArraytrueApiServiceFactory;
|
||||
|
||||
import io.swagger.annotations.ApiParam;
|
||||
|
||||
import com.sun.jersey.multipart.FormDataParam;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
import io.swagger.api.NotFoundException;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
import com.sun.jersey.core.header.FormDataContentDisposition;
|
||||
import com.sun.jersey.multipart.FormDataParam;
|
||||
|
||||
import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.SecurityContext;
|
||||
import javax.ws.rs.*;
|
||||
|
||||
@Path("/pet?testing_byte_array=true")
|
||||
|
||||
|
||||
@io.swagger.annotations.Api(description = "the pet?testing_byte_array=true API")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2016-01-14T20:53:59.204Z")
|
||||
public class PettestingByteArraytrueApi {
|
||||
private final PettestingByteArraytrueApiService delegate = PettestingByteArraytrueApiServiceFactory.getPettestingByteArraytrueApi();
|
||||
|
||||
@POST
|
||||
|
||||
@Consumes({ "application/json", "application/xml" })
|
||||
@Produces({ "application/json", "application/xml" })
|
||||
@io.swagger.annotations.ApiOperation(value = "Fake endpoint to test byte array in body parameter for adding a new pet to the store", 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")
|
||||
})
|
||||
}, tags={ "pet" })
|
||||
@io.swagger.annotations.ApiResponses(value = {
|
||||
@io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = Void.class) })
|
||||
|
||||
public Response addPetUsingByteArray(@ApiParam(value = "Pet object in the form of byte array" ) byte[] body,@Context SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
return delegate.addPetUsingByteArray(body,securityContext);
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package io.swagger.api;
|
||||
|
||||
import io.swagger.api.*;
|
||||
import io.swagger.model.*;
|
||||
|
||||
import com.sun.jersey.multipart.FormDataParam;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
import io.swagger.api.NotFoundException;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
import com.sun.jersey.core.header.FormDataContentDisposition;
|
||||
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 = "2016-01-14T20:53:59.204Z")
|
||||
public abstract class PettestingByteArraytrueApiService {
|
||||
|
||||
public abstract Response addPetUsingByteArray(byte[] body,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
|
||||
}
|
@ -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 = "2016-01-05T15:00:28.637+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2016-01-14T20:53:59.204Z")
|
||||
public class StoreApi {
|
||||
private final StoreApiService delegate = StoreApiServiceFactory.getStoreApi();
|
||||
|
||||
|
@ -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 = "2016-01-05T15:00:28.637+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2016-01-14T20:53:59.204Z")
|
||||
public abstract class StoreApiService {
|
||||
|
||||
public abstract Response getInventory(SecurityContext securityContext)
|
||||
|
@ -0,0 +1,42 @@
|
||||
package io.swagger.api;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2016-01-14T20:53:59.204Z")
|
||||
public class StringUtil {
|
||||
/**
|
||||
* Check if the given array contains the given value (with case-insensitive comparison).
|
||||
*
|
||||
* @param array The array
|
||||
* @param value The value to search
|
||||
* @return true if the array contains the value
|
||||
*/
|
||||
public static boolean containsIgnoreCase(String[] array, String value) {
|
||||
for (String str : array) {
|
||||
if (value == null && str == null) return true;
|
||||
if (value != null && value.equalsIgnoreCase(str)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Join an array of strings with the given separator.
|
||||
* <p>
|
||||
* Note: This might be replaced by utility method from commons-lang or guava someday
|
||||
* if one of those libraries is added as dependency.
|
||||
* </p>
|
||||
*
|
||||
* @param array The array of strings
|
||||
* @param separator The separator
|
||||
* @return the resulting string
|
||||
*/
|
||||
public static String join(String[] array, String separator) {
|
||||
int len = array.length;
|
||||
if (len == 0) return "";
|
||||
|
||||
StringBuilder out = new StringBuilder();
|
||||
out.append(array[0]);
|
||||
for (int i = 1; i < len; i++) {
|
||||
out.append(separator).append(array[i]);
|
||||
}
|
||||
return out.toString();
|
||||
}
|
||||
}
|
@ -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 = "2016-01-05T15:00:28.637+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2016-01-14T20:53:59.204Z")
|
||||
public class UserApi {
|
||||
private final UserApiService delegate = UserApiServiceFactory.getUserApi();
|
||||
|
||||
|
@ -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 = "2016-01-05T15:00:28.637+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2016-01-14T20:53:59.204Z")
|
||||
public abstract class UserApiService {
|
||||
|
||||
public abstract Response createUser(User body,SecurityContext securityContext)
|
||||
|
@ -10,7 +10,7 @@ import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2016-01-05T15:00:28.637+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2016-01-14T20:53:59.204Z")
|
||||
public class Category {
|
||||
|
||||
private Long id = null;
|
||||
|
@ -11,7 +11,7 @@ import java.util.Date;
|
||||
|
||||
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2016-01-05T15:00:28.637+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2016-01-14T20:53:59.204Z")
|
||||
public class Order {
|
||||
|
||||
private Long id = null;
|
||||
|
@ -13,7 +13,7 @@ import java.util.*;
|
||||
|
||||
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2016-01-05T15:00:28.637+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2016-01-14T20:53:59.204Z")
|
||||
public class Pet {
|
||||
|
||||
private Long id = null;
|
||||
|
@ -10,7 +10,7 @@ import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2016-01-05T15:00:28.637+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2016-01-14T20:53:59.204Z")
|
||||
public class Tag {
|
||||
|
||||
private Long id = null;
|
||||
|
@ -10,7 +10,7 @@ import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2016-01-05T15:00:28.637+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2016-01-14T20:53:59.204Z")
|
||||
public class User {
|
||||
|
||||
private Long id = null;
|
||||
|
@ -0,0 +1,15 @@
|
||||
package io.swagger.api.factories;
|
||||
|
||||
import io.swagger.api.PettestingByteArraytrueApiService;
|
||||
import io.swagger.api.impl.PettestingByteArraytrueApiServiceImpl;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2016-01-14T20:53:59.204Z")
|
||||
public class PettestingByteArraytrueApiServiceFactory {
|
||||
|
||||
private final static PettestingByteArraytrueApiService service = new PettestingByteArraytrueApiServiceImpl();
|
||||
|
||||
public static PettestingByteArraytrueApiService getPettestingByteArraytrueApi()
|
||||
{
|
||||
return service;
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package io.swagger.api.impl;
|
||||
|
||||
import io.swagger.api.*;
|
||||
import io.swagger.model.*;
|
||||
|
||||
import com.sun.jersey.multipart.FormDataParam;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
import io.swagger.api.NotFoundException;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
import com.sun.jersey.core.header.FormDataContentDisposition;
|
||||
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 = "2016-01-14T20:53:59.204Z")
|
||||
public class PettestingByteArraytrueApiServiceImpl extends PettestingByteArraytrueApiService {
|
||||
|
||||
@Override
|
||||
public Response addPetUsingByteArray(byte[] body,SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
// do some magic!
|
||||
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user