Skip to content

Commit 9d78fb3

Browse files
committed
Update 'jaxrs-cxf-client' sample
1 parent 3778b50 commit 9d78fb3

File tree

18 files changed

+958
-357
lines changed

18 files changed

+958
-357
lines changed

samples/client/petstore/jaxrs-cxf-client/.swagger-codegen-ignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,3 @@
2121
#docs/*.md
2222
# Then explicitly reverse the ignore rule for a single file:
2323
#!docs/README.md
24-
25-
**/impl/*
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.3.1-SNAPSHOT
1+
3.0.0-SNAPSHOT

samples/client/petstore/jaxrs-cxf-client/pom.xml

Lines changed: 17 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
<modelVersion>4.0.0</modelVersion>
33
<groupId>io.swagger</groupId>
44
<artifactId>jaxrs-cxf-petstore-client</artifactId>
5-
<packaging>war</packaging>
5+
<packaging>jar</packaging>
66
<name>jaxrs-cxf-petstore-client</name>
7+
78
<description>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 &#x60;special-key&#x60; to test the authorization filters.</description>
9+
810
<version>1.0.0</version>
911
<build>
1012
<sourceDirectory>src/main/java</sourceDirectory>
@@ -33,10 +35,11 @@
3335
<stopPort>8079</stopPort>
3436
<stopKey>stopit</stopKey>
3537
<httpConnector>
36-
<port>8080</port>
38+
<port></port>
3739
<idleTimeout>60000</idleTimeout>
3840
</httpConnector>
3941
</configuration>
42+
4043
<executions>
4144
<execution>
4245
<id>start-jetty</id>
@@ -77,15 +80,6 @@
7780
</execution>
7881
</executions>
7982
</plugin>
80-
81-
<!-- build WAR file -->
82-
<plugin>
83-
<artifactId>maven-war-plugin</artifactId>
84-
<version>3.1.0</version>
85-
<configuration>
86-
<failOnMissingWebXml>false</failOnMissingWebXml>
87-
</configuration>
88-
</plugin>
8983
</plugins>
9084
</build>
9185
<dependencies>
@@ -113,13 +107,7 @@
113107
<version>${junit-version}</version>
114108
<scope>test</scope>
115109
</dependency>
116-
<!-- Bean Validation API support -->
117-
<dependency>
118-
<groupId>javax.validation</groupId>
119-
<artifactId>validation-api</artifactId>
120-
<version>${beanvalidation-version}</version>
121-
<scope>provided</scope>
122-
</dependency>
110+
123111
<!-- CXF Client -->
124112
<dependency>
125113
<groupId>org.apache.cxf</groupId>
@@ -141,12 +129,6 @@
141129
<version>${cxf-version}</version>
142130
<scope>compile</scope>
143131
</dependency>
144-
<dependency>
145-
<groupId>org.apache.cxf</groupId>
146-
<artifactId>cxf-rt-rs-service-description-swagger</artifactId>
147-
<version>${cxf-version}</version>
148-
<scope>compile</scope>
149-
</dependency>
150132
<dependency>
151133
<groupId>org.apache.cxf</groupId>
152134
<artifactId>cxf-rt-ws-policy</artifactId>
@@ -165,12 +147,15 @@
165147
<version>${jackson-jaxrs-version}</version>
166148
<scope>compile</scope>
167149
</dependency>
150+
151+
168152
<dependency>
169-
<groupId>com.fasterxml.jackson.datatype</groupId>
170-
<artifactId>jackson-datatype-joda</artifactId>
171-
<version>${jackson-jaxrs-version}</version>
172-
<scope>compile</scope>
153+
<groupId>com.fasterxml.jackson.datatype</groupId>
154+
<artifactId>jackson-datatype-joda</artifactId>
155+
<version>${jackson-jaxrs-version}</version>
173156
</dependency>
157+
158+
174159
</dependencies>
175160
<repositories>
176161
<repository>
@@ -185,14 +170,14 @@
185170
<java.version>1.7</java.version>
186171
<maven.compiler.source>${java.version}</maven.compiler.source>
187172
<maven.compiler.target>${java.version}</maven.compiler.target>
188-
<swagger-core-version>1.5.15</swagger-core-version>
173+
<swagger-core-version>1.5.18</swagger-core-version>
189174
<jetty-version>9.2.9.v20150224</jetty-version>
190175
<junit-version>4.12</junit-version>
191176
<logback-version>1.1.7</logback-version>
192177
<servlet-api-version>2.5</servlet-api-version>
193-
<beanvalidation-version>1.1.0.Final</beanvalidation-version>
194-
<cxf-version>3.1.11</cxf-version>
195-
<jackson-jaxrs-version>2.8.9</jackson-jaxrs-version>
178+
179+
<cxf-version>3.2.1</cxf-version>
180+
<jackson-jaxrs-version>2.9.1</jackson-jaxrs-version>
196181
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
197182
</properties>
198183
</project>
Lines changed: 85 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
package io.swagger.api;
22

3-
import java.io.File;
43
import io.swagger.model.ModelApiResponse;
54
import io.swagger.model.Pet;
65

6+
77
import java.io.InputStream;
88
import java.io.OutputStream;
99
import java.util.List;
@@ -18,139 +18,191 @@
1818
import io.swagger.annotations.ApiResponses;
1919
import io.swagger.annotations.ApiResponse;
2020
import io.swagger.jaxrs.PATCH;
21-
import javax.validation.constraints.*;
22-
import javax.validation.Valid;
21+
22+
2323

2424
/**
2525
* Swagger Petstore
2626
*
27+
2728
* <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.
2829
*
30+
2931
*/
32+
3033
@Path("/")
3134
@Api(value = "/", description = "")
35+
3236
public interface PetApi {
3337

38+
39+
40+
3441
/**
3542
* Add a new pet to the store
3643
*
37-
*
38-
*
44+
3945
*/
46+
4047
@POST
4148
@Path("/pet")
49+
4250
@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={ })
4554
@ApiResponses(value = {
4655
@ApiResponse(code = 405, message = "Invalid input") })
47-
public void addPet(@Valid Pet body);
56+
public void addPet(Pet pet);
57+
4858

59+
4960
/**
5061
* Deletes a pet
5162
*
52-
*
53-
*
63+
5464
*/
65+
5566
@DELETE
5667
@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={ })
5971
@ApiResponses(value = {
6072
@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+
6275

76+
6377
/**
6478
* Finds Pets by status
6579
*
80+
6681
* Multiple status values can be provided with comma separated strings
6782
*
83+
6884
*/
85+
6986
@GET
7087
@Path("/pet/findByStatus")
88+
89+
7190
@Produces({ "application/xml", "application/json" })
72-
@ApiOperation(value = "Finds Pets by status", tags={ "pet", })
91+
92+
@ApiOperation(value = "Finds Pets by status", tags={ })
7393
@ApiResponses(value = {
7494
@ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"),
7595
@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+
7798

99+
78100
/**
79101
* Finds Pets by tags
80102
*
103+
81104
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
82105
*
106+
83107
*/
108+
84109
@GET
85110
@Path("/pet/findByTags")
111+
112+
86113
@Produces({ "application/xml", "application/json" })
87-
@ApiOperation(value = "Finds Pets by tags", tags={ "pet", })
114+
115+
@ApiOperation(value = "Finds Pets by tags", tags={ })
88116
@ApiResponses(value = {
89117
@ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"),
90118
@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);
92120

121+
122+
93123
/**
94124
* Find pet by ID
95125
*
126+
96127
* Returns a single pet
97128
*
129+
98130
*/
131+
99132
@GET
100133
@Path("/pet/{petId}")
134+
135+
101136
@Produces({ "application/xml", "application/json" })
102-
@ApiOperation(value = "Find pet by ID", tags={ "pet", })
137+
138+
@ApiOperation(value = "Find pet by ID", tags={ })
103139
@ApiResponses(value = {
104140
@ApiResponse(code = 200, message = "successful operation", response = Pet.class),
105141
@ApiResponse(code = 400, message = "Invalid ID supplied"),
106142
@ApiResponse(code = 404, message = "Pet not found") })
107-
public Pet getPetById(@PathParam("petId") Long petId);
143+
public Pet getPetById(@PathParam("petId") Integer petId);
144+
108145

146+
109147
/**
110148
* Update an existing pet
111149
*
112-
*
113-
*
150+
114151
*/
152+
115153
@PUT
116154
@Path("/pet")
155+
117156
@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={ })
120160
@ApiResponses(value = {
121161
@ApiResponse(code = 400, message = "Invalid ID supplied"),
122162
@ApiResponse(code = 404, message = "Pet not found"),
123163
@ApiResponse(code = 405, message = "Validation exception") })
124-
public void updatePet(@Valid Pet body);
164+
public void updatePet(Pet pet);
165+
125166

167+
126168
/**
127169
* Updates a pet in the store with form data
128170
*
129-
*
130-
*
171+
131172
*/
173+
132174
@POST
133175
@Path("/pet/{petId}")
176+
134177
@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={ })
137181
@ApiResponses(value = {
138182
@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+
140185

186+
141187
/**
142188
* uploads an image
143189
*
144-
*
145-
*
190+
146191
*/
192+
147193
@POST
148194
@Path("/pet/{petId}/uploadImage")
195+
149196
@Consumes({ "multipart/form-data" })
197+
198+
150199
@Produces({ "application/json" })
151-
@ApiOperation(value = "uploads an image", tags={ "pet" })
200+
201+
@ApiOperation(value = "uploads an image", tags={ })
152202
@ApiResponses(value = {
153203
@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+
155206
}
156207

208+

0 commit comments

Comments
 (0)