Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public class {{classname}} {
@ApiResponses(value = { {{#responses}}
@ApiResponse(code = {{{code}}}, message = "{{{message}}}", response = {{{returnType}}}.class{{#returnContainer}}, responseContainer = "{{{returnContainer}}}"{{/returnContainer}}){{#hasMore}},{{/hasMore}}{{/responses}} })
public Response {{nickname}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) {
return delegate.{{nickname}}({{#allParams}}{{#isFile}}{{paramName}}InputStream, {{paramName}}Detail{{/isFile}}{{^isFile}}{{paramName}}{{/isFile}}, {{/allParams}}securityContext);
return delegate.{{nickname}}({{#allParams}}{{#isFile}}{{paramName}}InputStream, {{paramName}}Detail{{/isFile}}{{^isFile}}{{paramName}}{{/isFile}}, {{/allParams}}securityContext);
}
{{/operation}}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package {{apiPackage}};

{{>generatedAnnotation}}
public class ApiException extends Exception{
private int code;
public ApiException (int code, String msg) {
super(msg);
this.code = code;
}
private int code;
public ApiException (int code, String msg) {
super(msg);
this.code = code;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ import javax.servlet.http.HttpServletResponse;

{{>generatedAnnotation}}
public class ApiOriginFilter implements javax.servlet.Filter {
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
HttpServletResponse res = (HttpServletResponse) response;
res.addHeader("Access-Control-Allow-Origin", "*");
res.addHeader("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT");
res.addHeader("Access-Control-Allow-Headers", "Content-Type");
chain.doFilter(request, response);
}
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
HttpServletResponse res = (HttpServletResponse) response;
res.addHeader("Access-Control-Allow-Origin", "*");
res.addHeader("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT");
res.addHeader("Access-Control-Allow-Headers", "Content-Type");
chain.doFilter(request, response);
}

public void destroy() {}
public void destroy() {}

public void init(FilterConfig filterConfig) throws ServletException {}
}
public void init(FilterConfig filterConfig) throws ServletException {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,65 +5,65 @@ import javax.xml.bind.annotation.XmlTransient;
@javax.xml.bind.annotation.XmlRootElement
{{>generatedAnnotation}}
public class ApiResponseMessage {
public static final int ERROR = 1;
public static final int WARNING = 2;
public static final int INFO = 3;
public static final int OK = 4;
public static final int TOO_BUSY = 5;
public static final int ERROR = 1;
public static final int WARNING = 2;
public static final int INFO = 3;
public static final int OK = 4;
public static final int TOO_BUSY = 5;

int code;
String type;
String message;
public ApiResponseMessage(){}
public ApiResponseMessage(int code, String message){
this.code = code;
switch(code){
case ERROR:
setType("error");
break;
case WARNING:
setType("warning");
break;
case INFO:
setType("info");
break;
case OK:
setType("ok");
break;
case TOO_BUSY:
setType("too busy");
break;
default:
setType("unknown");
break;
}
this.message = message;
}
int code;
String type;
String message;
public ApiResponseMessage(){}
public ApiResponseMessage(int code, String message){
this.code = code;
switch(code){
case ERROR:
setType("error");
break;
case WARNING:
setType("warning");
break;
case INFO:
setType("info");
break;
case OK:
setType("ok");
break;
case TOO_BUSY:
setType("too busy");
break;
default:
setType("unknown");
break;
}
this.message = message;
}

@XmlTransient
public int getCode() {
return code;
}
@XmlTransient
public int getCode() {
return code;
}

public void setCode(int code) {
this.code = code;
}
public void setCode(int code) {
this.code = code;
}

public String getType() {
return type;
}
public String getType() {
return type;
}

public void setType(String type) {
this.type = type;
}
public void setType(String type) {
this.type = type;
}

public String getMessage() {
return message;
}
public String getMessage() {
return message;
}

public void setMessage(String message) {
this.message = message;
}
public void setMessage(String message) {
this.message = message;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package {{apiPackage}};

{{>generatedAnnotation}}
public class NotFoundException extends ApiException {
private int code;
public NotFoundException (int code, String msg) {
super(code, msg);
this.code = code;
}
private int code;
public NotFoundException (int code, String msg) {
super(code, msg);
this.code = code;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ import javax.ws.rs.core.Application;

@ApplicationPath("/")
public class RestApplication extends Application {
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class {{classname}} {
@ApiResponses(value = { {{#responses}}
@ApiResponse(code = {{{code}}}, message = "{{{message}}}", response = {{{returnType}}}.class{{#returnContainer}}, responseContainer = "{{{returnContainer}}}"{{/returnContainer}}){{#hasMore}},{{/hasMore}}{{/responses}} })
public Response {{nickname}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}},{{/hasMore}}{{/allParams}}) {
return Response.ok().entity("magic!").build();
return Response.ok().entity("magic!").build();
}
{{/operation}}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
Expand All @@ -31,18 +31,18 @@
</plugins>
</build>
<dependencies>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<version>2.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<scope>provided</scope>
<version>1.5.3</version>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<version>2.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<scope>provided</scope>
<version>1.5.3</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Expand Down Expand Up @@ -82,4 +82,4 @@
<properties>
<junit-version>4.8.1</junit-version>
</properties>
</project>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public class PetApi {
@ApiResponses(value = {
@ApiResponse(code = 405, message = "Invalid input", response = void.class) })
public Response addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true) Pet body) {
return delegate.addPet(body, securityContext);
return delegate.addPet(body, securityContext);
}

@DELETE
Expand All @@ -64,7 +64,7 @@ public Response addPet(@ApiParam(value = "Pet object that needs to be added to t
@ApiResponses(value = {
@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) {
return delegate.deletePet(petId, apiKey, securityContext);
return delegate.deletePet(petId, apiKey, securityContext);
}

@GET
Expand All @@ -81,7 +81,7 @@ public Response deletePet(@ApiParam(value = "Pet id to delete",required=true) @P
@ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"),
@ApiResponse(code = 400, message = "Invalid status value", response = Pet.class, responseContainer = "List") })
public Response findPetsByStatus( @NotNull @ApiParam(value = "Status values that need to be considered for filter",required=true, allowableValues="available, pending, sold") @QueryParam("status") List<String> status) {
return delegate.findPetsByStatus(status, securityContext);
return delegate.findPetsByStatus(status, securityContext);
}

@GET
Expand All @@ -98,7 +98,7 @@ public Response findPetsByStatus( @NotNull @ApiParam(value = "Status values that
@ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"),
@ApiResponse(code = 400, message = "Invalid tag value", response = Pet.class, responseContainer = "List") })
public Response findPetsByTags( @NotNull @ApiParam(value = "Tags to filter by",required=true) @QueryParam("tags") List<String> tags) {
return delegate.findPetsByTags(tags, securityContext);
return delegate.findPetsByTags(tags, securityContext);
}

@GET
Expand All @@ -113,7 +113,7 @@ public Response findPetsByTags( @NotNull @ApiParam(value = "Tags to filter by",r
@ApiResponse(code = 400, message = "Invalid ID supplied", response = Pet.class),
@ApiResponse(code = 404, message = "Pet not found", response = Pet.class) })
public Response getPetById(@ApiParam(value = "ID of pet to return",required=true) @PathParam("petId") Long petId) {
return delegate.getPetById(petId, securityContext);
return delegate.getPetById(petId, securityContext);
}

@PUT
Expand All @@ -131,7 +131,7 @@ public Response getPetById(@ApiParam(value = "ID of pet to return",required=true
@ApiResponse(code = 404, message = "Pet not found", response = void.class),
@ApiResponse(code = 405, message = "Validation exception", response = void.class) })
public Response updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true) Pet body) {
return delegate.updatePet(body, securityContext);
return delegate.updatePet(body, securityContext);
}

@POST
Expand All @@ -147,7 +147,7 @@ public Response updatePet(@ApiParam(value = "Pet object that needs to be added t
@ApiResponses(value = {
@ApiResponse(code = 405, message = "Invalid input", response = void.class) })
public Response updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true) @PathParam("petId") Long petId, @Multipart(value = "name", required = false) String name, @Multipart(value = "status", required = false) String status) {
return delegate.updatePetWithForm(petId, name, status, securityContext);
return delegate.updatePetWithForm(petId, name, status, securityContext);
}

@POST
Expand All @@ -163,6 +163,6 @@ public Response updatePetWithForm(@ApiParam(value = "ID of pet that needs to be
@ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) })
public Response uploadFile(@ApiParam(value = "ID of pet to update",required=true) @PathParam("petId") Long petId, @Multipart(value = "additionalMetadata", required = false) String additionalMetadata, @Multipart(value = "file", required = false) InputStream fileInputStream, @Multipart(value = "file" , required = false) Attachment fileDetail) {
return delegate.uploadFile(petId, additionalMetadata, fileInputStream, fileDetail, securityContext);
return delegate.uploadFile(petId, additionalMetadata, fileInputStream, fileDetail, securityContext);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class StoreApi {
@ApiResponse(code = 400, message = "Invalid ID supplied", response = void.class),
@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") String orderId) {
return delegate.deleteOrder(orderId, securityContext);
return delegate.deleteOrder(orderId, securityContext);
}

@GET
Expand All @@ -56,7 +56,7 @@ public Response deleteOrder(@ApiParam(value = "ID of the order that needs to be
@ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation", response = Integer.class, responseContainer = "Map") })
public Response getInventory() {
return delegate.getInventory(securityContext);
return delegate.getInventory(securityContext);
}

@GET
Expand All @@ -69,7 +69,7 @@ public Response getInventory() {
@ApiResponse(code = 400, message = "Invalid ID supplied", response = Order.class),
@ApiResponse(code = 404, message = "Order not found", response = Order.class) })
public Response getOrderById( @Min(1) @Max(5)@ApiParam(value = "ID of pet that needs to be fetched",required=true) @PathParam("orderId") Long orderId) {
return delegate.getOrderById(orderId, securityContext);
return delegate.getOrderById(orderId, securityContext);
}

@POST
Expand All @@ -81,6 +81,6 @@ public Response getOrderById( @Min(1) @Max(5)@ApiParam(value = "ID of pet that n
@ApiResponse(code = 200, message = "successful operation", response = Order.class),
@ApiResponse(code = 400, message = "Invalid Order", response = Order.class) })
public Response placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true) Order body) {
return delegate.placeOrder(body, securityContext);
return delegate.placeOrder(body, securityContext);
}
}
Loading