Skip to content

Commit 0dab200

Browse files
ePaulwing328
authored andcommitted
Update spring samples with current code. (#4874)
* Update spring samples with current code. This is done so I can see my own changes better. * Regenerate samples after 2.2.2.
1 parent 55b64fc commit 0dab200

File tree

13 files changed

+104
-22
lines changed

13 files changed

+104
-22
lines changed

samples/client/petstore/spring-cloud/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# swagger-spring
1+
# swagger-petstore-spring-cloud
22

33
## Requirements
44

@@ -27,7 +27,7 @@ Add this dependency to your project's POM:
2727
```xml
2828
<dependency>
2929
<groupId>io.swagger</groupId>
30-
<artifactId>swagger-spring</artifactId>
30+
<artifactId>swagger-petstore-spring-cloud</artifactId>
3131
<version>1.0.0</version>
3232
<scope>compile</scope>
3333
</dependency>
@@ -38,7 +38,7 @@ Add this dependency to your project's POM:
3838
Add this dependency to your project's build file:
3939

4040
```groovy
41-
compile "io.swagger:swagger-spring:1.0.0"
41+
compile "io.swagger:swagger-petstore-spring-cloud:1.0.0"
4242
```
4343

4444
### Others
@@ -49,5 +49,5 @@ mvn package
4949

5050
Then manually install the following JARs:
5151

52-
* target/swagger-spring-1.0.0.jar
52+
* target/swagger-petstore-spring-cloud-1.0.0.jar
5353
* target/lib/*.jar

samples/client/petstore/spring-cloud/pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
22
<modelVersion>4.0.0</modelVersion>
33
<groupId>io.swagger</groupId>
4-
<artifactId>swagger-cloud</artifactId>
4+
<artifactId>swagger-petstore-spring-cloud</artifactId>
55
<packaging>jar</packaging>
6-
<name>swagger-cloud</name>
6+
<name>swagger-petstore-spring-cloud</name>
77
<version>1.0.0</version>
88
<properties>
99
<java.version>1.7</java.version>
1010
<maven.compiler.source>${java.version}</maven.compiler.source>
1111
<maven.compiler.target>${java.version}</maven.compiler.target>
12-
<swagger-core-version>1.5.9</swagger-core-version>
12+
<swagger-core-version>1.5.12</swagger-core-version>
1313
</properties>
1414
<parent>
1515
<groupId>org.springframework.boot</groupId>
@@ -72,4 +72,4 @@
7272
<scope>test</scope>
7373
</dependency>
7474
</dependencies>
75-
</project>
75+
</project>

samples/client/petstore/spring-stubs/pom.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,12 @@
4949
<groupId>joda-time</groupId>
5050
<artifactId>joda-time</artifactId>
5151
</dependency>
52+
<!-- Bean Validation API support -->
53+
<dependency>
54+
<groupId>javax.validation</groupId>
55+
<artifactId>validation-api</artifactId>
56+
<version>1.1.0.Final</version>
57+
<scope>provided</scope>
58+
</dependency>
5259
</dependencies>
5360
</project>

samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/PetApi.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import org.springframework.web.multipart.MultipartFile;
1717

1818
import java.util.List;
19-
19+
import javax.validation.constraints.*;
2020

2121
@Api(value = "pet", description = "the pet API")
2222
public interface PetApi {
@@ -65,7 +65,7 @@ ResponseEntity<Void> deletePet(@ApiParam(value = "Pet id to delete",required=tru
6565
produces = "application/json",
6666
consumes = "application/json",
6767
method = RequestMethod.GET)
68-
ResponseEntity<List<Pet>> findPetsByStatus(@ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "AVAILABLE, PENDING, SOLD") @RequestParam(value = "status", required = true) List<String> status);
68+
ResponseEntity<List<Pet>> findPetsByStatus( @NotNull @ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "AVAILABLE, PENDING, SOLD") @RequestParam(value = "status", required = true) List<String> status);
6969

7070

7171
@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", authorizations = {
@@ -81,7 +81,7 @@ ResponseEntity<Void> deletePet(@ApiParam(value = "Pet id to delete",required=tru
8181
produces = "application/json",
8282
consumes = "application/json",
8383
method = RequestMethod.GET)
84-
ResponseEntity<List<Pet>> findPetsByTags(@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List<String> tags);
84+
ResponseEntity<List<Pet>> findPetsByTags( @NotNull @ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List<String> tags);
8585

8686

8787
@ApiOperation(value = "Find pet by ID", notes = "Returns a single pet", response = Pet.class, authorizations = {

samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/StoreApi.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import org.springframework.web.multipart.MultipartFile;
1616

1717
import java.util.List;
18-
18+
import javax.validation.constraints.*;
1919

2020
@Api(value = "store", description = "the store API")
2121
public interface StoreApi {
@@ -52,7 +52,7 @@ public interface StoreApi {
5252
produces = "application/json",
5353
consumes = "application/json",
5454
method = RequestMethod.GET)
55-
ResponseEntity<Order> getOrderById(@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("orderId") Long orderId);
55+
ResponseEntity<Order> getOrderById( @Min(1) @Max(5)@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("orderId") Long orderId);
5656

5757

5858
@ApiOperation(value = "Place an order for a pet", notes = "", response = Order.class, tags={ "store", })

samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/UserApi.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import org.springframework.web.multipart.MultipartFile;
1616

1717
import java.util.List;
18-
18+
import javax.validation.constraints.*;
1919

2020
@Api(value = "user", description = "the user API")
2121
public interface UserApi {
@@ -81,8 +81,8 @@ public interface UserApi {
8181
produces = "application/json",
8282
consumes = "application/json",
8383
method = RequestMethod.GET)
84-
ResponseEntity<String> loginUser(@ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username,
85-
@ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password);
84+
ResponseEntity<String> loginUser( @NotNull @ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username,
85+
@NotNull @ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password);
8686

8787

8888
@ApiOperation(value = "Logs out current logged in user session", notes = "", response = Void.class, tags={ "user", })

samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Category.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import com.fasterxml.jackson.annotation.JsonCreator;
66
import io.swagger.annotations.ApiModel;
77
import io.swagger.annotations.ApiModelProperty;
8-
8+
import javax.validation.constraints.*;
99
/**
1010
* A category for a pet
1111
*/

samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/ModelApiResponse.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import com.fasterxml.jackson.annotation.JsonCreator;
66
import io.swagger.annotations.ApiModel;
77
import io.swagger.annotations.ApiModelProperty;
8-
8+
import javax.validation.constraints.*;
99
/**
1010
* Describes the result of uploading an image resource
1111
*/

samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Order.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import io.swagger.annotations.ApiModel;
88
import io.swagger.annotations.ApiModelProperty;
99
import org.joda.time.DateTime;
10-
10+
import javax.validation.constraints.*;
1111
/**
1212
* An order for a pets from the pet store
1313
*/

samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Pet.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import io.swagger.model.Tag;
1111
import java.util.ArrayList;
1212
import java.util.List;
13-
13+
import javax.validation.constraints.*;
1414
/**
1515
* A pet for sale in the pet store
1616
*/
@@ -114,6 +114,7 @@ public Pet name(String name) {
114114
* @return name
115115
**/
116116
@ApiModelProperty(example = "doggie", required = true, value = "")
117+
@NotNull
117118
public String getName() {
118119
return name;
119120
}
@@ -137,6 +138,7 @@ public Pet addPhotoUrlsItem(String photoUrlsItem) {
137138
* @return photoUrls
138139
**/
139140
@ApiModelProperty(required = true, value = "")
141+
@NotNull
140142
public List<String> getPhotoUrls() {
141143
return photoUrls;
142144
}

0 commit comments

Comments
 (0)