|
2 | 2 |
|
3 | 3 | import io.swagger.model.*;
|
4 | 4 |
|
5 |
| -import io.swagger.annotations.ApiParam; |
6 |
| -import io.swagger.jaxrs.*; |
7 |
| - |
| 5 | +import io.swagger.v3.oas.annotations.Operation; |
| 6 | +import io.swagger.v3.oas.annotations.Parameter; |
| 7 | +import io.swagger.v3.oas.annotations.responses.ApiResponses; |
| 8 | +import io.swagger.v3.oas.annotations.responses.ApiResponse; |
| 9 | +import io.swagger.v3.oas.annotations.media.ArraySchema; |
| 10 | +import io.swagger.v3.oas.annotations.media.Content; |
| 11 | +import io.swagger.v3.oas.annotations.media.Schema; |
| 12 | +import io.swagger.v3.oas.annotations.security.SecurityRequirement; |
| 13 | + |
| 14 | +import java.io.File; |
8 | 15 | import io.swagger.model.ModelApiResponse;
|
9 | 16 | import io.swagger.model.Pet;
|
10 | 17 |
|
11 |
| - |
12 | 18 | import java.util.List;
|
13 | 19 | import java.util.Map;
|
14 | 20 |
|
|
18 | 24 | import javax.ws.rs.core.Response;
|
19 | 25 | import javax.ws.rs.core.SecurityContext;
|
20 | 26 | import javax.ws.rs.*;
|
21 |
| - |
22 | 27 | import javax.validation.constraints.*;
|
23 |
| - |
24 |
| - |
| 28 | +import org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataInput; |
25 | 29 | @Path("/pet")
|
26 | 30 |
|
27 | 31 |
|
28 |
| -@io.swagger.annotations.Api(description = "the pet API") |
29 |
| - |
30 |
| - |
31 | 32 | public interface PetApi {
|
32 | 33 |
|
33 |
| - |
34 | 34 | @POST
|
35 |
| - |
36 | 35 | @Consumes({ "application/json", "application/xml" })
|
37 |
| - |
38 |
| - @io.swagger.annotations.ApiOperation(value = "Add a new pet to the store", notes = "", response = Void.class, tags={ "pet", }) |
39 |
| - @io.swagger.annotations.ApiResponses(value = { |
40 |
| - @io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) |
41 |
| - public Response addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true) Pet pet,@Context SecurityContext securityContext); |
| 36 | + @Operation(summary = "Add a new pet to the store", description = "", tags={ "pet" }) |
| 37 | + @ApiResponses(value = { |
| 38 | + @ApiResponse(responseCode = "405", description = "Invalid input") |
| 39 | + }) |
| 40 | + Response addPet(@Parameter(description = "Pet object that needs to be added to the store" ,required=true) Pet body,@Context SecurityContext securityContext); |
42 | 41 |
|
43 | 42 | @DELETE
|
44 | 43 | @Path("/{petId}")
|
45 |
| - |
46 |
| - |
47 |
| - @io.swagger.annotations.ApiOperation(value = "Deletes a pet", notes = "", response = Void.class, tags={ "pet", }) |
48 |
| - @io.swagger.annotations.ApiResponses(value = { |
49 |
| - @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid pet value", response = Void.class) }) |
50 |
| - public Response deletePet( @PathParam("petId") Integer petId,@ApiParam(value = "" )@HeaderParam("api_key") String apiKey,@Context SecurityContext securityContext); |
| 44 | + @Operation(summary = "Deletes a pet", description = "", tags={ "pet" }) |
| 45 | + @ApiResponses(value = { |
| 46 | + @ApiResponse(responseCode = "400", description = "Invalid pet value") |
| 47 | + }) |
| 48 | + Response deletePet( @PathParam("petId") Integer petId,@Parameter(description = "" )@HeaderParam("api_key") String apiKey,@Context SecurityContext securityContext); |
51 | 49 |
|
52 | 50 | @GET
|
53 | 51 | @Path("/findByStatus")
|
54 |
| - |
55 | 52 | @Produces({ "application/xml", "application/json" })
|
56 |
| - @io.swagger.annotations.ApiOperation(value = "Finds Pets by status", notes = "Multiple status values can be provided with comma separated strings", response = Pet.class, responseContainer = "List", tags={ "pet", }) |
57 |
| - @io.swagger.annotations.ApiResponses(value = { |
58 |
| - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"), |
59 |
| - |
60 |
| - @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid status value", response = Void.class) }) |
61 |
| - public Response findPetsByStatus( @NotNull @QueryParam("status") List<String> status,@Context SecurityContext securityContext); |
| 53 | + @Operation(summary = "Finds Pets by status", description = "Multiple status values can be provided with comma separated strings", tags={ "pet" }) |
| 54 | + @ApiResponses(value = { |
| 55 | + @ApiResponse(responseCode = "200", description = "successful operation", content = @Content(array = @ArraySchema(schema = @Schema(implementation = Pet.class)))), |
| 56 | + @ApiResponse(responseCode = "400", description = "Invalid status value") |
| 57 | + }) |
| 58 | + Response findPetsByStatus( @NotNull @QueryParam("status") List<String> status,@Context SecurityContext securityContext); |
62 | 59 |
|
63 | 60 | @GET
|
64 | 61 | @Path("/findByTags")
|
65 |
| - |
66 | 62 | @Produces({ "application/xml", "application/json" })
|
67 |
| - @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", tags={ "pet", }) |
68 |
| - @io.swagger.annotations.ApiResponses(value = { |
69 |
| - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"), |
70 |
| - |
71 |
| - @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid tag value", response = Void.class) }) |
72 |
| - public Response findPetsByTags( @NotNull @QueryParam("tags") List<String> tags,@Context SecurityContext securityContext); |
| 63 | + @Operation(summary = "Finds Pets by tags", description = "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.", tags={ "pet" }) |
| 64 | + @ApiResponses(value = { |
| 65 | + @ApiResponse(responseCode = "200", description = "successful operation", content = @Content(array = @ArraySchema(schema = @Schema(implementation = Pet.class)))), |
| 66 | + @ApiResponse(responseCode = "400", description = "Invalid tag value") |
| 67 | + }) |
| 68 | + Response findPetsByTags( @NotNull @QueryParam("tags") List<String> tags,@Context SecurityContext securityContext); |
73 | 69 |
|
74 | 70 | @GET
|
75 | 71 | @Path("/{petId}")
|
76 |
| - |
77 | 72 | @Produces({ "application/xml", "application/json" })
|
78 |
| - @io.swagger.annotations.ApiOperation(value = "Find pet by ID", notes = "Returns a single pet", response = Pet.class, tags={ "pet", }) |
79 |
| - @io.swagger.annotations.ApiResponses(value = { |
80 |
| - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class), |
81 |
| - |
82 |
| - @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), |
83 |
| - |
84 |
| - @io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found", response = Void.class) }) |
85 |
| - public Response getPetById( @PathParam("petId") Integer petId,@Context SecurityContext securityContext); |
| 73 | + @Operation(summary = "Find pet by ID", description = "Returns a single pet", tags={ "pet" }) |
| 74 | + @ApiResponses(value = { |
| 75 | + @ApiResponse(responseCode = "200", description = "successful operation", content = @Content(schema = @Schema(implementation = Pet.class))), |
| 76 | + @ApiResponse(responseCode = "400", description = "Invalid ID supplied"), |
| 77 | + @ApiResponse(responseCode = "404", description = "Pet not found") |
| 78 | + }) |
| 79 | + Response getPetById( @PathParam("petId") Integer petId,@Context SecurityContext securityContext); |
86 | 80 |
|
87 | 81 | @PUT
|
88 |
| - |
89 | 82 | @Consumes({ "application/json", "application/xml" })
|
90 |
| - |
91 |
| - @io.swagger.annotations.ApiOperation(value = "Update an existing pet", notes = "", response = Void.class, tags={ "pet", }) |
92 |
| - @io.swagger.annotations.ApiResponses(value = { |
93 |
| - @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), |
94 |
| - |
95 |
| - @io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found", response = Void.class), |
96 |
| - |
97 |
| - @io.swagger.annotations.ApiResponse(code = 405, message = "Validation exception", response = Void.class) }) |
98 |
| - public Response updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true) Pet pet,@Context SecurityContext securityContext); |
| 83 | + @Operation(summary = "Update an existing pet", description = "", tags={ "pet" }) |
| 84 | + @ApiResponses(value = { |
| 85 | + @ApiResponse(responseCode = "400", description = "Invalid ID supplied"), |
| 86 | + @ApiResponse(responseCode = "404", description = "Pet not found"), |
| 87 | + @ApiResponse(responseCode = "405", description = "Validation exception") |
| 88 | + }) |
| 89 | + Response updatePet(@Parameter(description = "Pet object that needs to be added to the store" ,required=true) Pet body,@Context SecurityContext securityContext); |
99 | 90 |
|
100 | 91 | @POST
|
101 | 92 | @Path("/{petId}")
|
102 | 93 | @Consumes({ "application/x-www-form-urlencoded" })
|
103 |
| - |
104 |
| - @io.swagger.annotations.ApiOperation(value = "Updates a pet in the store with form data", notes = "", response = Void.class, tags={ "pet", }) |
105 |
| - @io.swagger.annotations.ApiResponses(value = { |
106 |
| - @io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) |
107 |
| - public Response updatePetWithForm( @PathParam("petId") Integer petId,@ApiParam(value = "" ) Object body,@Context SecurityContext securityContext); |
| 94 | + @Operation(summary = "Updates a pet in the store with form data", description = "", tags={ "pet" }) |
| 95 | + @ApiResponses(value = { |
| 96 | + @ApiResponse(responseCode = "405", description = "Invalid input") |
| 97 | + }) |
| 98 | + Response updatePetWithForm( @PathParam("petId") Integer petId,@Parameter(description = "")@FormParam("name") String name,@Parameter(description = "")@FormParam("status") String status,@Context SecurityContext securityContext); |
108 | 99 |
|
109 | 100 | @POST
|
110 | 101 | @Path("/{petId}/uploadImage")
|
111 | 102 | @Consumes({ "multipart/form-data" })
|
112 | 103 | @Produces({ "application/json" })
|
113 |
| - @io.swagger.annotations.ApiOperation(value = "uploads an image", notes = "", response = ModelApiResponse.class, tags={ "pet", }) |
114 |
| - @io.swagger.annotations.ApiResponses(value = { |
115 |
| - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) }) |
116 |
| - public Response uploadFile( @PathParam("petId") Integer petId,@ApiParam(value = "" ) Object body,@Context SecurityContext securityContext); |
| 104 | + @Operation(summary = "uploads an image", description = "", tags={ "pet" }) |
| 105 | + @ApiResponses(value = { |
| 106 | + @ApiResponse(responseCode = "200", description = "successful operation", content = @Content(schema = @Schema(implementation = ModelApiResponse.class))) |
| 107 | + }) |
| 108 | + Response uploadFile(MultipartFormDataInput input, @PathParam("petId") Integer petId,@Context SecurityContext securityContext); |
117 | 109 |
|
118 | 110 | }
|
119 |
| - |
0 commit comments