16
16
17
17
package io .swagger .sample .resource ;
18
18
19
- import io.swagger.annotations.*;
19
+ import io .swagger .oas .annotations .Operation ;
20
+ import io .swagger .oas .annotations .Parameter ;
21
+ import io .swagger .oas .annotations .media .Content ;
22
+ import io .swagger .oas .annotations .media .Schema ;
23
+ import io .swagger .oas .annotations .responses .ApiResponse ;
20
24
import io .swagger .sample .data .StoreData ;
21
25
import io .swagger .sample .model .AuthenticationInfo ;
22
26
import io .swagger .sample .model .Order ;
25
29
import javax .ws .rs .*;
26
30
27
31
@ Path ("/store" )
28
- @Api(value="/store" , description = "Operations about store")
29
32
@ Produces ({"application/json" , "application/xml" })
30
33
public class PetStoreResource {
31
34
static StoreData storeData = new StoreData ();
32
35
33
36
@ GET
34
37
@ Path ("/order/{orderId}" )
35
- @ApiOperation(value = "Find purchase order by ID",
36
- notes = "For valid response try integer IDs with value >= 1 and <= 10. Other values will generated exceptions",
37
- response = Order.class)
38
- @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid ID supplied"),
39
- @ApiResponse(code = 404, message = "Order not found") })
38
+ @ Operation (
39
+ summary = "Find purchase order by ID" ,
40
+ description = "For valid response try integer IDs with value >= 1 and <= 10. Other values will generated exceptions" ,
41
+ responses = {
42
+ @ ApiResponse (content = @ Content (schema = @ Schema (implementation = Order .class ))),
43
+ @ ApiResponse (responseCode = "400" , description = "Invalid ID supplied" ),
44
+ @ ApiResponse (responseCode = "404" , description = "Order not found" )
45
+ }
46
+ )
40
47
public Response getOrderById (
41
48
@ BeanParam AuthenticationInfo info ,
42
- @ApiParam(value = "ID of order to fetch") @PathParam("orderId") Long orderId)
49
+ @ Parameter ( description = "ID of order to fetch" ) @ PathParam ("orderId" ) Long orderId )
43
50
throws io .swagger .sample .exception .NotFoundException {
44
51
Order order = storeData .findOrderById (orderId );
45
52
if (null != order ) {
@@ -51,24 +58,32 @@ public Response getOrderById(
51
58
52
59
@ POST
53
60
@ Path ("/order" )
54
- @ApiOperation(value = "Place an order for a pet",
55
- response = Order.class)
56
- @ApiResponses({ @ApiResponse(code = 400, message = "Invalid Order") })
61
+ @ Operation (
62
+ summary = "Place an order for a pet" ,
63
+ responses = {
64
+ @ ApiResponse (content = @ Content (schema = @ Schema (implementation = Order .class ))),
65
+ @ ApiResponse (responseCode = "400" , description = "Invalid Order" )
66
+ }
67
+ )
57
68
public Response placeOrder (
58
69
@ BeanParam AuthenticationInfo info ,
59
- @ApiParam(value = "order placed for purchasing the pet", required = true) Order order) {
70
+ @ Parameter ( description = "order placed for purchasing the pet" , required = true ) Order order ) {
60
71
storeData .placeOrder (order );
61
72
return Response .ok ().entity ("" ).build ();
62
73
}
63
74
64
75
@ DELETE
65
76
@ Path ("/order/{orderId}" )
66
- @ApiOperation(value = "Delete purchase order by ID")
67
- @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid ID supplied"),
68
- @ApiResponse(code = 404, message = "Order not found") })
77
+ @ Operation (
78
+ summary = "Delete purchase order by ID" ,
79
+ responses = {
80
+ @ ApiResponse (responseCode = "400" , description = "Invalid ID supplied" ),
81
+ @ ApiResponse (responseCode = "404" , description = "Order not found" )
82
+ }
83
+ )
69
84
public Response deleteOrder (
70
85
@ BeanParam AuthenticationInfo info ,
71
- @ApiParam(value = "ID of order to delete") @PathParam("orderId") Long orderId) {
86
+ @ Parameter ( description = "ID of order to delete" ) @ PathParam ("orderId" ) Long orderId ) {
72
87
if (storeData .deleteOrder (orderId )) {
73
88
return Response .ok ().entity ("" ).build ();
74
89
} else {
0 commit comments