|
1 | 1 | package io.swagger.api;
|
2 | 2 |
|
3 |
| -import java.io.File; |
4 | 3 | import io.swagger.model.ModelApiResponse;
|
5 | 4 | import io.swagger.model.Pet;
|
6 | 5 |
|
| 6 | + |
7 | 7 | import java.io.InputStream;
|
8 | 8 | import java.io.OutputStream;
|
9 | 9 | import java.util.List;
|
|
18 | 18 | import io.swagger.annotations.ApiResponses;
|
19 | 19 | import io.swagger.annotations.ApiResponse;
|
20 | 20 | import io.swagger.jaxrs.PATCH;
|
21 |
| -import javax.validation.constraints.*; |
22 |
| -import javax.validation.Valid; |
| 21 | + |
| 22 | + |
23 | 23 |
|
24 | 24 | /**
|
25 | 25 | * Swagger Petstore
|
26 | 26 | *
|
| 27 | + |
27 | 28 | * <p>This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
|
28 | 29 | *
|
| 30 | + |
29 | 31 | */
|
| 32 | + |
30 | 33 | @Path("/")
|
31 | 34 | @Api(value = "/", description = "")
|
| 35 | + |
32 | 36 | public interface PetApi {
|
33 | 37 |
|
| 38 | + |
| 39 | + |
| 40 | + |
34 | 41 | /**
|
35 | 42 | * Add a new pet to the store
|
36 | 43 | *
|
37 |
| - * |
38 |
| - * |
| 44 | + |
39 | 45 | */
|
| 46 | + |
40 | 47 | @POST
|
41 | 48 | @Path("/pet")
|
| 49 | + |
42 | 50 | @Consumes({ "application/json", "application/xml" })
|
43 |
| - @Produces({ "application/xml", "application/json" }) |
44 |
| - @ApiOperation(value = "Add a new pet to the store", tags={ "pet", }) |
| 51 | + |
| 52 | + |
| 53 | + @ApiOperation(value = "Add a new pet to the store", tags={ }) |
45 | 54 | @ApiResponses(value = {
|
46 | 55 | @ApiResponse(code = 405, message = "Invalid input") })
|
47 |
| - public void addPet(@Valid Pet body); |
| 56 | + public void addPet(Pet pet); |
| 57 | + |
48 | 58 |
|
| 59 | + |
49 | 60 | /**
|
50 | 61 | * Deletes a pet
|
51 | 62 | *
|
52 |
| - * |
53 |
| - * |
| 63 | + |
54 | 64 | */
|
| 65 | + |
55 | 66 | @DELETE
|
56 | 67 | @Path("/pet/{petId}")
|
57 |
| - @Produces({ "application/xml", "application/json" }) |
58 |
| - @ApiOperation(value = "Deletes a pet", tags={ "pet", }) |
| 68 | + |
| 69 | + |
| 70 | + @ApiOperation(value = "Deletes a pet", tags={ }) |
59 | 71 | @ApiResponses(value = {
|
60 | 72 | @ApiResponse(code = 400, message = "Invalid pet value") })
|
61 |
| - public void deletePet(@PathParam("petId") Long petId, @HeaderParam("api_key") String apiKey); |
| 73 | + public void deletePet(@PathParam("petId") Integer petId, @HeaderParam("api_key") String apiKey); |
| 74 | + |
62 | 75 |
|
| 76 | + |
63 | 77 | /**
|
64 | 78 | * Finds Pets by status
|
65 | 79 | *
|
| 80 | + |
66 | 81 | * Multiple status values can be provided with comma separated strings
|
67 | 82 | *
|
| 83 | + |
68 | 84 | */
|
| 85 | + |
69 | 86 | @GET
|
70 | 87 | @Path("/pet/findByStatus")
|
| 88 | + |
| 89 | + |
71 | 90 | @Produces({ "application/xml", "application/json" })
|
72 |
| - @ApiOperation(value = "Finds Pets by status", tags={ "pet", }) |
| 91 | + |
| 92 | + @ApiOperation(value = "Finds Pets by status", tags={ }) |
73 | 93 | @ApiResponses(value = {
|
74 | 94 | @ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"),
|
75 | 95 | @ApiResponse(code = 400, message = "Invalid status value") })
|
76 |
| - public List<Pet> findPetsByStatus(@QueryParam("status") @NotNull List<String> status); |
| 96 | + public List<Pet> findPetsByStatus(@QueryParam("status")List<String> status); |
| 97 | + |
77 | 98 |
|
| 99 | + |
78 | 100 | /**
|
79 | 101 | * Finds Pets by tags
|
80 | 102 | *
|
| 103 | + |
81 | 104 | * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
82 | 105 | *
|
| 106 | + |
83 | 107 | */
|
| 108 | + |
84 | 109 | @GET
|
85 | 110 | @Path("/pet/findByTags")
|
| 111 | + |
| 112 | + |
86 | 113 | @Produces({ "application/xml", "application/json" })
|
87 |
| - @ApiOperation(value = "Finds Pets by tags", tags={ "pet", }) |
| 114 | + |
| 115 | + @ApiOperation(value = "Finds Pets by tags", tags={ }) |
88 | 116 | @ApiResponses(value = {
|
89 | 117 | @ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"),
|
90 | 118 | @ApiResponse(code = 400, message = "Invalid tag value") })
|
91 |
| - public List<Pet> findPetsByTags(@QueryParam("tags") @NotNull List<String> tags); |
| 119 | + public List<Pet> findPetsByTags(@QueryParam("tags")List<String> tags); |
92 | 120 |
|
| 121 | + |
| 122 | + |
93 | 123 | /**
|
94 | 124 | * Find pet by ID
|
95 | 125 | *
|
| 126 | + |
96 | 127 | * Returns a single pet
|
97 | 128 | *
|
| 129 | + |
98 | 130 | */
|
| 131 | + |
99 | 132 | @GET
|
100 | 133 | @Path("/pet/{petId}")
|
| 134 | + |
| 135 | + |
101 | 136 | @Produces({ "application/xml", "application/json" })
|
102 |
| - @ApiOperation(value = "Find pet by ID", tags={ "pet", }) |
| 137 | + |
| 138 | + @ApiOperation(value = "Find pet by ID", tags={ }) |
103 | 139 | @ApiResponses(value = {
|
104 | 140 | @ApiResponse(code = 200, message = "successful operation", response = Pet.class),
|
105 | 141 | @ApiResponse(code = 400, message = "Invalid ID supplied"),
|
106 | 142 | @ApiResponse(code = 404, message = "Pet not found") })
|
107 |
| - public Pet getPetById(@PathParam("petId") Long petId); |
| 143 | + public Pet getPetById(@PathParam("petId") Integer petId); |
| 144 | + |
108 | 145 |
|
| 146 | + |
109 | 147 | /**
|
110 | 148 | * Update an existing pet
|
111 | 149 | *
|
112 |
| - * |
113 |
| - * |
| 150 | + |
114 | 151 | */
|
| 152 | + |
115 | 153 | @PUT
|
116 | 154 | @Path("/pet")
|
| 155 | + |
117 | 156 | @Consumes({ "application/json", "application/xml" })
|
118 |
| - @Produces({ "application/xml", "application/json" }) |
119 |
| - @ApiOperation(value = "Update an existing pet", tags={ "pet", }) |
| 157 | + |
| 158 | + |
| 159 | + @ApiOperation(value = "Update an existing pet", tags={ }) |
120 | 160 | @ApiResponses(value = {
|
121 | 161 | @ApiResponse(code = 400, message = "Invalid ID supplied"),
|
122 | 162 | @ApiResponse(code = 404, message = "Pet not found"),
|
123 | 163 | @ApiResponse(code = 405, message = "Validation exception") })
|
124 |
| - public void updatePet(@Valid Pet body); |
| 164 | + public void updatePet(Pet pet); |
| 165 | + |
125 | 166 |
|
| 167 | + |
126 | 168 | /**
|
127 | 169 | * Updates a pet in the store with form data
|
128 | 170 | *
|
129 |
| - * |
130 |
| - * |
| 171 | + |
131 | 172 | */
|
| 173 | + |
132 | 174 | @POST
|
133 | 175 | @Path("/pet/{petId}")
|
| 176 | + |
134 | 177 | @Consumes({ "application/x-www-form-urlencoded" })
|
135 |
| - @Produces({ "application/xml", "application/json" }) |
136 |
| - @ApiOperation(value = "Updates a pet in the store with form data", tags={ "pet", }) |
| 178 | + |
| 179 | + |
| 180 | + @ApiOperation(value = "Updates a pet in the store with form data", tags={ }) |
137 | 181 | @ApiResponses(value = {
|
138 | 182 | @ApiResponse(code = 405, message = "Invalid input") })
|
139 |
| - public void updatePetWithForm(@PathParam("petId") Long petId, @Multipart(value = "name", required = false) String name, @Multipart(value = "status", required = false) String status); |
| 183 | + public void updatePetWithForm(@PathParam("petId") Integer petId, Object body); |
| 184 | + |
140 | 185 |
|
| 186 | + |
141 | 187 | /**
|
142 | 188 | * uploads an image
|
143 | 189 | *
|
144 |
| - * |
145 |
| - * |
| 190 | + |
146 | 191 | */
|
| 192 | + |
147 | 193 | @POST
|
148 | 194 | @Path("/pet/{petId}/uploadImage")
|
| 195 | + |
149 | 196 | @Consumes({ "multipart/form-data" })
|
| 197 | + |
| 198 | + |
150 | 199 | @Produces({ "application/json" })
|
151 |
| - @ApiOperation(value = "uploads an image", tags={ "pet" }) |
| 200 | + |
| 201 | + @ApiOperation(value = "uploads an image", tags={ }) |
152 | 202 | @ApiResponses(value = {
|
153 | 203 | @ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) })
|
154 |
| - public ModelApiResponse uploadFile(@PathParam("petId") Long petId, @Multipart(value = "additionalMetadata", required = false) String additionalMetadata, @Multipart(value = "file" , required = false) Attachment fileDetail); |
| 204 | + public ModelApiResponse uploadFile(@PathParam("petId") Integer petId, Object body); |
| 205 | + |
155 | 206 | }
|
156 | 207 |
|
| 208 | + |
0 commit comments