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