Skip to content

Commit 2d24e99

Browse files
committed
update jaxrs sample
1 parent 4d76dd2 commit 2d24e99

File tree

7 files changed

+422
-397
lines changed

7 files changed

+422
-397
lines changed

samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/api/PetApiService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,6 @@ public abstract Response updatePet(Pet body,SecurityContext securityContext)
3636
throws NotFoundException;
3737
public abstract Response updatePetWithForm(Long petId,String name,String status,SecurityContext securityContext)
3838
throws NotFoundException;
39-
public abstract Response uploadFile(Long petId,String additionalMetadata,InputStream inputStream, FormDataContentDisposition fileDetail,SecurityContext securityContext)
39+
public abstract Response uploadFile(Long petId,String additionalMetadata,InputStream fileInputStream, FormDataContentDisposition fileDetail,SecurityContext securityContext)
4040
throws NotFoundException;
4141
}

samples/server/petstore/jaxrs/jersey1/src/main/java/io/swagger/api/impl/PetApiServiceImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public Response updatePetWithForm(Long petId, String name, String status, Securi
6565
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
6666
}
6767
@Override
68-
public Response uploadFile(Long petId, String additionalMetadata, InputStream inputStream, FormDataContentDisposition fileDetail, SecurityContext securityContext)
68+
public Response uploadFile(Long petId, String additionalMetadata, InputStream fileInputStream, FormDataContentDisposition fileDetail, SecurityContext securityContext)
6969
throws NotFoundException {
7070
// do some magic!
7171
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();

samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/PetApi.java

Lines changed: 186 additions & 173 deletions
Large diffs are not rendered by default.

samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/PetApiService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
77

88
import io.swagger.model.Pet;
9-
import io.swagger.model.ModelApiResponse;
109
import java.io.File;
10+
import io.swagger.model.ModelApiResponse;
1111

1212
import java.util.List;
1313
import io.swagger.api.NotFoundException;
@@ -26,5 +26,5 @@ public abstract class PetApiService {
2626
public abstract Response getPetById(Long petId,SecurityContext securityContext) throws NotFoundException;
2727
public abstract Response updatePet(Pet body,SecurityContext securityContext) throws NotFoundException;
2828
public abstract Response updatePetWithForm(Long petId,String name,String status,SecurityContext securityContext) throws NotFoundException;
29-
public abstract Response uploadFile(Long petId,String additionalMetadata,InputStream inputStream, FormDataContentDisposition fileDetail,SecurityContext securityContext) throws NotFoundException;
29+
public abstract Response uploadFile(Long petId,String additionalMetadata,InputStream fileInputStream, FormDataContentDisposition fileDetail,SecurityContext securityContext) throws NotFoundException;
3030
}
Lines changed: 90 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -1,87 +1,90 @@
1-
package io.swagger.api;
2-
3-
import io.swagger.model.*;
4-
import io.swagger.api.StoreApiService;
5-
import io.swagger.api.factories.StoreApiServiceFactory;
6-
7-
import io.swagger.annotations.ApiParam;
8-
9-
import java.util.Map;
10-
import io.swagger.model.Order;
11-
12-
import java.util.List;
13-
import io.swagger.api.NotFoundException;
14-
15-
import java.io.InputStream;
16-
17-
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
18-
import org.glassfish.jersey.media.multipart.FormDataParam;
19-
20-
import javax.ws.rs.core.Context;
21-
import javax.ws.rs.core.Response;
22-
import javax.ws.rs.core.SecurityContext;
23-
import javax.ws.rs.*;
24-
25-
@Path("/store")
26-
27-
28-
@io.swagger.annotations.Api(description = "the store API")
29-
30-
public class StoreApi {
31-
private final StoreApiService delegate = StoreApiServiceFactory.getStoreApi();
32-
33-
@DELETE
34-
@Path("/order/{orderId}")
35-
36-
@Produces({ "application/xml", "application/json" })
37-
@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", })
38-
@io.swagger.annotations.ApiResponses(value = {
39-
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = void.class),
40-
41-
@io.swagger.annotations.ApiResponse(code = 404, message = "Order not found", response = void.class) })
42-
public Response deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true) @PathParam("orderId") String orderId,@Context SecurityContext securityContext)
43-
throws NotFoundException {
44-
return delegate.deleteOrder(orderId,securityContext);
45-
}
46-
@GET
47-
@Path("/inventory")
48-
49-
@Produces({ "application/json" })
50-
@io.swagger.annotations.ApiOperation(value = "Returns pet inventories by status", notes = "Returns a map of status codes to quantities", response = Integer.class, responseContainer = "Map", authorizations = {
51-
@io.swagger.annotations.Authorization(value = "api_key")
52-
}, tags={ "store", })
53-
@io.swagger.annotations.ApiResponses(value = {
54-
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Integer.class, responseContainer = "Map") })
55-
public Response getInventory(@Context SecurityContext securityContext)
56-
throws NotFoundException {
57-
return delegate.getInventory(securityContext);
58-
}
59-
@GET
60-
@Path("/order/{orderId}")
61-
62-
@Produces({ "application/xml", "application/json" })
63-
@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", })
64-
@io.swagger.annotations.ApiResponses(value = {
65-
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Order.class),
66-
67-
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = Order.class),
68-
69-
@io.swagger.annotations.ApiResponse(code = 404, message = "Order not found", response = Order.class) })
70-
public Response getOrderById(@ApiParam(value = "ID of pet that needs to be fetched",required=true) @PathParam("orderId") Long orderId,@Context SecurityContext securityContext)
71-
throws NotFoundException {
72-
return delegate.getOrderById(orderId,securityContext);
73-
}
74-
@POST
75-
@Path("/order")
76-
77-
@Produces({ "application/xml", "application/json" })
78-
@io.swagger.annotations.ApiOperation(value = "Place an order for a pet", notes = "", response = Order.class, tags={ "store", })
79-
@io.swagger.annotations.ApiResponses(value = {
80-
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Order.class),
81-
82-
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid Order", response = Order.class) })
83-
public Response placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true) Order body,@Context SecurityContext securityContext)
84-
throws NotFoundException {
85-
return delegate.placeOrder(body,securityContext);
86-
}
87-
}
1+
package io.swagger.api;
2+
3+
import io.swagger.model.*;
4+
import io.swagger.api.StoreApiService;
5+
import io.swagger.api.factories.StoreApiServiceFactory;
6+
7+
import io.swagger.annotations.ApiParam;
8+
9+
import java.util.Map;
10+
import io.swagger.model.Order;
11+
12+
import java.util.List;
13+
import io.swagger.api.NotFoundException;
14+
15+
import java.io.InputStream;
16+
17+
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
18+
import org.glassfish.jersey.media.multipart.FormDataParam;
19+
20+
import javax.ws.rs.core.Context;
21+
import javax.ws.rs.core.Response;
22+
import javax.ws.rs.core.SecurityContext;
23+
import javax.ws.rs.*;
24+
25+
@Path("/store")
26+
27+
28+
@io.swagger.annotations.Api(description = "the store API")
29+
30+
public class StoreApi {
31+
private final StoreApiService delegate = StoreApiServiceFactory.getStoreApi();
32+
33+
@DELETE
34+
@Path("/order/{orderId}")
35+
36+
@Produces({ "application/xml", "application/json" })
37+
@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", })
38+
@io.swagger.annotations.ApiResponses(value = {
39+
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = void.class),
40+
41+
@io.swagger.annotations.ApiResponse(code = 404, message = "Order not found", response = void.class) })
42+
public Response deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true) @PathParam("orderId") String orderId
43+
,@Context SecurityContext securityContext)
44+
throws NotFoundException {
45+
return delegate.deleteOrder(orderId,securityContext);
46+
}
47+
@GET
48+
@Path("/inventory")
49+
50+
@Produces({ "application/json" })
51+
@io.swagger.annotations.ApiOperation(value = "Returns pet inventories by status", notes = "Returns a map of status codes to quantities", response = Integer.class, responseContainer = "Map", authorizations = {
52+
@io.swagger.annotations.Authorization(value = "api_key")
53+
}, tags={ "store", })
54+
@io.swagger.annotations.ApiResponses(value = {
55+
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Integer.class, responseContainer = "Map") })
56+
public Response getInventory(@Context SecurityContext securityContext)
57+
throws NotFoundException {
58+
return delegate.getInventory(securityContext);
59+
}
60+
@GET
61+
@Path("/order/{orderId}")
62+
63+
@Produces({ "application/xml", "application/json" })
64+
@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", })
65+
@io.swagger.annotations.ApiResponses(value = {
66+
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Order.class),
67+
68+
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = Order.class),
69+
70+
@io.swagger.annotations.ApiResponse(code = 404, message = "Order not found", response = Order.class) })
71+
public Response getOrderById(@ApiParam(value = "ID of pet that needs to be fetched",required=true) @PathParam("orderId") Long orderId
72+
,@Context SecurityContext securityContext)
73+
throws NotFoundException {
74+
return delegate.getOrderById(orderId,securityContext);
75+
}
76+
@POST
77+
@Path("/order")
78+
79+
@Produces({ "application/xml", "application/json" })
80+
@io.swagger.annotations.ApiOperation(value = "Place an order for a pet", notes = "", response = Order.class, tags={ "store", })
81+
@io.swagger.annotations.ApiResponses(value = {
82+
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Order.class),
83+
84+
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid Order", response = Order.class) })
85+
public Response placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true) Order body
86+
,@Context SecurityContext securityContext)
87+
throws NotFoundException {
88+
return delegate.placeOrder(body,securityContext);
89+
}
90+
}

0 commit comments

Comments
 (0)