Skip to content

Commit 724c0f9

Browse files
committed
Update all jaxrs samples
1 parent ac5c4e3 commit 724c0f9

File tree

547 files changed

+29707
-5153
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

547 files changed

+29707
-5153
lines changed

samples/server/petstore/jaxrs-cxf-annotated-base-path/.swagger-codegen-ignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,5 @@
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.0-SNAPSHOT
1+
3.0.0-SNAPSHOT

samples/server/petstore/jaxrs-cxf-annotated-base-path/pom.xml

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
<artifactId>swagger-cxf-annotated-basepath</artifactId>
55
<packaging>war</packaging>
66
<name>swagger-cxf-annotated-basepath</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,19 @@
3335
<stopPort>8079</stopPort>
3436
<stopKey>stopit</stopKey>
3537
<httpConnector>
36-
<port>8080</port>
38+
<port>-1</port>
3739
<idleTimeout>60000</idleTimeout>
3840
</httpConnector>
3941
</configuration>
42+
43+
<dependencies>
44+
<dependency>
45+
<groupId>javax.validation</groupId>
46+
<artifactId>validation-api</artifactId>
47+
<version>${beanvalidation-version}</version>
48+
</dependency>
49+
</dependencies>
50+
4051
<executions>
4152
<execution>
4253
<id>start-jetty</id>
@@ -113,13 +124,15 @@
113124
<version>${junit-version}</version>
114125
<scope>test</scope>
115126
</dependency>
127+
116128
<!-- Bean Validation API support -->
117129
<dependency>
118130
<groupId>javax.validation</groupId>
119131
<artifactId>validation-api</artifactId>
120132
<version>${beanvalidation-version}</version>
121133
<scope>provided</scope>
122134
</dependency>
135+
123136
<!-- CXF Client -->
124137
<dependency>
125138
<groupId>org.apache.cxf</groupId>
@@ -165,12 +178,17 @@
165178
<version>${jackson-jaxrs-version}</version>
166179
<scope>compile</scope>
167180
</dependency>
181+
182+
168183
<dependency>
169-
<groupId>com.fasterxml.jackson.datatype</groupId>
170-
<artifactId>jackson-datatype-joda</artifactId>
171-
<version>${jackson-jaxrs-version}</version>
172-
<scope>compile</scope>
184+
<groupId>com.fasterxml.jackson.datatype</groupId>
185+
<artifactId>jackson-datatype-joda</artifactId>
186+
<version>${jackson-jaxrs-version}</version>
173187
</dependency>
188+
189+
190+
191+
174192
</dependencies>
175193
<repositories>
176194
<repository>
@@ -185,14 +203,18 @@
185203
<java.version>1.7</java.version>
186204
<maven.compiler.source>${java.version}</maven.compiler.source>
187205
<maven.compiler.target>${java.version}</maven.compiler.target>
188-
<swagger-core-version>1.5.15</swagger-core-version>
206+
<swagger-core-version>1.5.18</swagger-core-version>
189207
<jetty-version>9.2.9.v20150224</jetty-version>
190208
<junit-version>4.12</junit-version>
191209
<logback-version>1.1.7</logback-version>
192210
<servlet-api-version>2.5</servlet-api-version>
211+
193212
<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>
213+
214+
215+
216+
<cxf-version>3.2.1</cxf-version>
217+
<jackson-jaxrs-version>2.9.1</jackson-jaxrs-version>
196218
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
197219
</properties>
198220
</project>
Lines changed: 83 additions & 28 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,194 @@
1818
import io.swagger.annotations.ApiResponses;
1919
import io.swagger.annotations.ApiResponse;
2020
import io.swagger.jaxrs.PATCH;
21+
2122
import javax.validation.constraints.*;
2223
import javax.validation.Valid;
2324

25+
26+
2427
/**
2528
* Swagger Petstore
2629
*
30+
2731
* <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.
2832
*
33+
2934
*/
35+
3036
@Path("/v2")
3137
@Api(value = "/", description = "")
38+
3239
public interface PetApi {
3340

41+
42+
43+
3444
/**
3545
* Add a new pet to the store
3646
*
37-
*
38-
*
47+
3948
*/
49+
4050
@POST
4151
@Path("/pet")
52+
4253
@Consumes({ "application/json", "application/xml" })
43-
@Produces({ "application/xml", "application/json" })
44-
@ApiOperation(value = "Add a new pet to the store", tags={ "pet", })
54+
55+
56+
@ApiOperation(value = "Add a new pet to the store", tags={ "pet" })
4557
@ApiResponses(value = {
4658
@ApiResponse(code = 405, message = "Invalid input") })
47-
public void addPet(@Valid Pet body);
59+
public void addPet(@Valid Pet pet);
4860

61+
62+
4963
/**
5064
* Deletes a pet
5165
*
52-
*
53-
*
66+
5467
*/
68+
5569
@DELETE
5670
@Path("/pet/{petId}")
57-
@Produces({ "application/xml", "application/json" })
58-
@ApiOperation(value = "Deletes a pet", tags={ "pet", })
71+
72+
73+
@ApiOperation(value = "Deletes a pet", tags={ "pet" })
5974
@ApiResponses(value = {
6075
@ApiResponse(code = 400, message = "Invalid pet value") })
61-
public void deletePet(@PathParam("petId") Long petId, @HeaderParam("api_key") String apiKey);
76+
public void deletePet(@PathParam("petId") Integer petId, @HeaderParam("api_key") String apiKey);
77+
6278

79+
6380
/**
6481
* Finds Pets by status
6582
*
83+
6684
* Multiple status values can be provided with comma separated strings
6785
*
86+
6887
*/
88+
6989
@GET
7090
@Path("/pet/findByStatus")
91+
92+
7193
@Produces({ "application/xml", "application/json" })
72-
@ApiOperation(value = "Finds Pets by status", tags={ "pet", })
94+
95+
@ApiOperation(value = "Finds Pets by status", tags={ "pet" })
7396
@ApiResponses(value = {
7497
@ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"),
7598
@ApiResponse(code = 400, message = "Invalid status value") })
7699
public List<Pet> findPetsByStatus(@QueryParam("status") @NotNull List<String> status);
77100

101+
102+
78103
/**
79104
* Finds Pets by tags
80105
*
106+
81107
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
82108
*
109+
83110
*/
111+
84112
@GET
85113
@Path("/pet/findByTags")
114+
115+
86116
@Produces({ "application/xml", "application/json" })
87-
@ApiOperation(value = "Finds Pets by tags", tags={ "pet", })
117+
118+
@ApiOperation(value = "Finds Pets by tags", tags={ "pet" })
88119
@ApiResponses(value = {
89120
@ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"),
90121
@ApiResponse(code = 400, message = "Invalid tag value") })
91122
public List<Pet> findPetsByTags(@QueryParam("tags") @NotNull List<String> tags);
92123

124+
125+
93126
/**
94127
* Find pet by ID
95128
*
129+
96130
* Returns a single pet
97131
*
132+
98133
*/
134+
99135
@GET
100136
@Path("/pet/{petId}")
137+
138+
101139
@Produces({ "application/xml", "application/json" })
102-
@ApiOperation(value = "Find pet by ID", tags={ "pet", })
140+
141+
@ApiOperation(value = "Find pet by ID", tags={ "pet" })
103142
@ApiResponses(value = {
104143
@ApiResponse(code = 200, message = "successful operation", response = Pet.class),
105144
@ApiResponse(code = 400, message = "Invalid ID supplied"),
106145
@ApiResponse(code = 404, message = "Pet not found") })
107-
public Pet getPetById(@PathParam("petId") Long petId);
146+
public Pet getPetById(@PathParam("petId") Integer petId);
147+
108148

149+
109150
/**
110151
* Update an existing pet
111152
*
112-
*
113-
*
153+
114154
*/
155+
115156
@PUT
116157
@Path("/pet")
158+
117159
@Consumes({ "application/json", "application/xml" })
118-
@Produces({ "application/xml", "application/json" })
119-
@ApiOperation(value = "Update an existing pet", tags={ "pet", })
160+
161+
162+
@ApiOperation(value = "Update an existing pet", tags={ "pet" })
120163
@ApiResponses(value = {
121164
@ApiResponse(code = 400, message = "Invalid ID supplied"),
122165
@ApiResponse(code = 404, message = "Pet not found"),
123166
@ApiResponse(code = 405, message = "Validation exception") })
124-
public void updatePet(@Valid Pet body);
167+
public void updatePet(@Valid Pet pet);
168+
125169

170+
126171
/**
127172
* Updates a pet in the store with form data
128173
*
129-
*
130-
*
174+
131175
*/
176+
132177
@POST
133178
@Path("/pet/{petId}")
179+
134180
@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", })
181+
182+
183+
@ApiOperation(value = "Updates a pet in the store with form data", tags={ "pet" })
137184
@ApiResponses(value = {
138185
@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);
186+
public void updatePetWithForm(@PathParam("petId") Integer petId, @Valid Object body);
187+
140188

189+
141190
/**
142191
* uploads an image
143192
*
144-
*
145-
*
193+
146194
*/
195+
147196
@POST
148197
@Path("/pet/{petId}/uploadImage")
198+
149199
@Consumes({ "multipart/form-data" })
200+
201+
150202
@Produces({ "application/json" })
203+
151204
@ApiOperation(value = "uploads an image", tags={ "pet" })
152205
@ApiResponses(value = {
153206
@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);
207+
public ModelApiResponse uploadFile(@PathParam("petId") Integer petId, @Valid Object body);
208+
155209
}
156210

211+

0 commit comments

Comments
 (0)