Skip to content

Commit 33a137f

Browse files
committed
updated resteasy joda sample.
1 parent c138515 commit 33a137f

21 files changed

+255
-648
lines changed

samples/server/petstore/jaxrs-resteasy/joda/pom.xml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,8 @@
6565
<version>7.0</version>
6666
<scope>provided</scope>
6767
</dependency>
68-
6968
<dependency>
70-
<groupId>io.swagger</groupId>
69+
<groupId>io.swagger.core.v3</groupId>
7170
<artifactId>swagger-annotations</artifactId>
7271
<version>${swagger-core-version}</version>
7372
</dependency>
@@ -93,7 +92,6 @@
9392
<groupId>org.jboss.resteasy</groupId>
9493
<artifactId>jaxrs-api</artifactId>
9594
<version>${resteasy-version}</version>
96-
<scope>provided</scope>
9795
</dependency>
9896
<dependency>
9997
<groupId>org.jboss.resteasy</groupId>
@@ -131,8 +129,8 @@
131129
<version>2.7</version>
132130
</dependency>
133131
<dependency>
134-
<groupId>io.swagger</groupId>
135-
<artifactId>swagger-jaxrs</artifactId>
132+
<groupId>io.swagger.core.v3</groupId>
133+
<artifactId>swagger-jaxrs2</artifactId>
136134
<version>${swagger-core-version}</version>
137135
</dependency>
138136
<dependency>
@@ -161,7 +159,6 @@
161159
</exclusion>
162160
</exclusions>
163161
</dependency>
164-
165162
<!-- Bean Validation API support -->
166163
<dependency>
167164
<groupId>javax.validation</groupId>
@@ -170,7 +167,6 @@
170167
<scope>provided</scope>
171168
</dependency>
172169

173-
174170
</dependencies>
175171
<repositories>
176172
<repository>
@@ -182,7 +178,7 @@
182178
</repository>
183179
</repositories>
184180
<properties>
185-
<swagger-core-version>1.5.18</swagger-core-version>
181+
<swagger-core-version>2.0.0</swagger-core-version>
186182
<jetty-version>9.2.9.v20150224</jetty-version>
187183
<resteasy-version>3.0.11.Final</resteasy-version>
188184
<slf4j-version>1.6.3</slf4j-version>

samples/server/petstore/jaxrs-resteasy/joda/src/gen/java/io/swagger/api/ApiException.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package io.swagger.api;
22

3-
43
public class ApiException extends Exception{
54
private int code;
65
public ApiException (int code, String msg) {

samples/server/petstore/jaxrs-resteasy/joda/src/gen/java/io/swagger/api/ApiOriginFilter.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import javax.servlet.*;
66
import javax.servlet.http.HttpServletResponse;
77

8-
98
public class ApiOriginFilter implements javax.servlet.Filter {
109
public void doFilter(ServletRequest request, ServletResponse response,
1110
FilterChain chain) throws IOException, ServletException {

samples/server/petstore/jaxrs-resteasy/joda/src/gen/java/io/swagger/api/ApiResponseMessage.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import javax.xml.bind.annotation.XmlTransient;
44

55
@javax.xml.bind.annotation.XmlRootElement
6-
76
public class ApiResponseMessage {
87
public static final int ERROR = 1;
98
public static final int WARNING = 2;

samples/server/petstore/jaxrs-resteasy/joda/src/gen/java/io/swagger/api/NotFoundException.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package io.swagger.api;
22

3-
43
public class NotFoundException extends ApiException {
54
private int code;
65
public NotFoundException (int code, String msg) {

samples/server/petstore/jaxrs-resteasy/joda/src/gen/java/io/swagger/api/PetApi.java

Lines changed: 80 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,19 @@
33
import io.swagger.model.*;
44
import io.swagger.api.PetApiService;
55

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;
916
import io.swagger.model.ModelApiResponse;
1017
import io.swagger.model.Pet;
1118

12-
1319
import java.util.Map;
1420
import java.util.List;
1521
import io.swagger.api.NotFoundException;
@@ -22,128 +28,143 @@
2228
import javax.ws.rs.*;
2329
import javax.inject.Inject;
2430

25-
2631
import javax.validation.constraints.*;
27-
28-
32+
import org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataInput;
2933
@Path("/pet")
3034

3135

32-
@io.swagger.annotations.Api(description = "the pet API")
33-
34-
3536
public class PetApi {
3637

3738
@Inject PetApiService service;
3839

39-
4040
@POST
4141

4242
@Consumes({ "application/json", "application/xml" })
4343

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)
4852
throws NotFoundException {
49-
return service.addPet(pet,securityContext);
53+
return service.addPet(body,securityContext);
5054
}
51-
5255
@DELETE
5356
@Path("/{petId}")
5457

5558

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)
6067
throws NotFoundException {
6168
return service.deletePet(petId,apiKey,securityContext);
6269
}
63-
6470
@GET
6571
@Path("/findByStatus")
6672

6773
@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)))),
7181

72-
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid status value", response = Void.class) })
82+
@ApiResponse(responseCode = "400", description = "Invalid status value") })
7383
public Response findPetsByStatus( @NotNull @QueryParam("status") List<String> status,@Context SecurityContext securityContext)
7484
throws NotFoundException {
7585
return service.findPetsByStatus(status,securityContext);
7686
}
77-
7887
@GET
7988
@Path("/findByTags")
8089

8190
@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)))),
8598

86-
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid tag value", response = Void.class) })
99+
@ApiResponse(responseCode = "400", description = "Invalid tag value") })
87100
public Response findPetsByTags( @NotNull @QueryParam("tags") List<String> tags,@Context SecurityContext securityContext)
88101
throws NotFoundException {
89102
return service.findPetsByTags(tags,securityContext);
90103
}
91-
92104
@GET
93105
@Path("/{petId}")
94106

95107
@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))),
99113

100-
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class),
114+
@ApiResponse(responseCode = "400", description = "Invalid ID supplied"),
101115

102-
@io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found", response = Void.class) })
116+
@ApiResponse(responseCode = "404", description = "Pet not found") })
103117
public Response getPetById( @PathParam("petId") Integer petId,@Context SecurityContext securityContext)
104118
throws NotFoundException {
105119
return service.getPetById(petId,securityContext);
106120
}
107-
108121
@PUT
109122

110123
@Consumes({ "application/json", "application/xml" })
111124

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"),
115132

116-
@io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found", response = Void.class),
133+
@ApiResponse(responseCode = "404", description = "Pet not found"),
117134

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)
120137
throws NotFoundException {
121-
return service.updatePet(pet,securityContext);
138+
return service.updatePet(body,securityContext);
122139
}
123-
124140
@POST
125141
@Path("/{petId}")
126142
@Consumes({ "application/x-www-form-urlencoded" })
127143

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)
132152
throws NotFoundException {
133-
return service.updatePetWithForm(petId,body,securityContext);
153+
return service.updatePetWithForm(petId,name,status,securityContext);
134154
}
135-
136155
@POST
137156
@Path("/{petId}/uploadImage")
138157
@Consumes({ "multipart/form-data" })
139158
@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)
144167
throws NotFoundException {
145-
return service.uploadFile(petId,body,securityContext);
168+
return service.uploadFile(input,petId,securityContext);
146169
}
147-
148170
}
149-

samples/server/petstore/jaxrs-resteasy/joda/src/gen/java/io/swagger/api/PetApiService.java

Lines changed: 10 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
import io.swagger.api.*;
44
import io.swagger.model.*;
5+
import org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataInput;
56

6-
7+
import java.io.File;
78
import io.swagger.model.ModelApiResponse;
89
import io.swagger.model.Pet;
910

10-
1111
import java.util.List;
1212
import io.swagger.api.NotFoundException;
1313

@@ -16,33 +16,13 @@
1616
import javax.ws.rs.core.Response;
1717
import javax.ws.rs.core.SecurityContext;
1818

19-
20-
2119
public interface PetApiService {
22-
23-
Response addPet(Pet pet,SecurityContext securityContext)
24-
throws NotFoundException;
25-
26-
Response deletePet(Integer petId,String apiKey,SecurityContext securityContext)
27-
throws NotFoundException;
28-
29-
Response findPetsByStatus(List<String> status,SecurityContext securityContext)
30-
throws NotFoundException;
31-
32-
Response findPetsByTags(List<String> tags,SecurityContext securityContext)
33-
throws NotFoundException;
34-
35-
Response getPetById(Integer petId,SecurityContext securityContext)
36-
throws NotFoundException;
37-
38-
Response updatePet(Pet pet,SecurityContext securityContext)
39-
throws NotFoundException;
40-
41-
Response updatePetWithForm(Integer petId,Object body,SecurityContext securityContext)
42-
throws NotFoundException;
43-
44-
Response uploadFile(Integer petId,Object body,SecurityContext securityContext)
45-
throws NotFoundException;
46-
20+
Response addPet(Pet body,SecurityContext securityContext) throws NotFoundException;
21+
Response deletePet(Integer petId,String apiKey,SecurityContext securityContext) throws NotFoundException;
22+
Response findPetsByStatus(List<String> status,SecurityContext securityContext) throws NotFoundException;
23+
Response findPetsByTags(List<String> tags,SecurityContext securityContext) throws NotFoundException;
24+
Response getPetById(Integer petId,SecurityContext securityContext) throws NotFoundException;
25+
Response updatePet(Pet body,SecurityContext securityContext) throws NotFoundException;
26+
Response updatePetWithForm(Integer petId,String name,String status,SecurityContext securityContext) throws NotFoundException;
27+
Response uploadFile(MultipartFormDataInput input,Integer petId,SecurityContext securityContext) throws NotFoundException;
4728
}
48-

0 commit comments

Comments
 (0)