forked from loafle/openapi-generator-original
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.
This commit is contained in:
parent
55b64fcbfd
commit
0dab200f28
@ -1,4 +1,4 @@
|
|||||||
# swagger-spring
|
# swagger-petstore-spring-cloud
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
@ -27,7 +27,7 @@ Add this dependency to your project's POM:
|
|||||||
```xml
|
```xml
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.swagger</groupId>
|
<groupId>io.swagger</groupId>
|
||||||
<artifactId>swagger-spring</artifactId>
|
<artifactId>swagger-petstore-spring-cloud</artifactId>
|
||||||
<version>1.0.0</version>
|
<version>1.0.0</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
@ -38,7 +38,7 @@ Add this dependency to your project's POM:
|
|||||||
Add this dependency to your project's build file:
|
Add this dependency to your project's build file:
|
||||||
|
|
||||||
```groovy
|
```groovy
|
||||||
compile "io.swagger:swagger-spring:1.0.0"
|
compile "io.swagger:swagger-petstore-spring-cloud:1.0.0"
|
||||||
```
|
```
|
||||||
|
|
||||||
### Others
|
### Others
|
||||||
@ -49,5 +49,5 @@ mvn package
|
|||||||
|
|
||||||
Then manually install the following JARs:
|
Then manually install the following JARs:
|
||||||
|
|
||||||
* target/swagger-spring-1.0.0.jar
|
* target/swagger-petstore-spring-cloud-1.0.0.jar
|
||||||
* target/lib/*.jar
|
* target/lib/*.jar
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
<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">
|
<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">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>io.swagger</groupId>
|
<groupId>io.swagger</groupId>
|
||||||
<artifactId>swagger-cloud</artifactId>
|
<artifactId>swagger-petstore-spring-cloud</artifactId>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<name>swagger-cloud</name>
|
<name>swagger-petstore-spring-cloud</name>
|
||||||
<version>1.0.0</version>
|
<version>1.0.0</version>
|
||||||
<properties>
|
<properties>
|
||||||
<java.version>1.7</java.version>
|
<java.version>1.7</java.version>
|
||||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||||
<maven.compiler.target>${java.version}</maven.compiler.target>
|
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||||
<swagger-core-version>1.5.9</swagger-core-version>
|
<swagger-core-version>1.5.12</swagger-core-version>
|
||||||
</properties>
|
</properties>
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
@ -72,4 +72,4 @@
|
|||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
@ -49,5 +49,12 @@
|
|||||||
<groupId>joda-time</groupId>
|
<groupId>joda-time</groupId>
|
||||||
<artifactId>joda-time</artifactId>
|
<artifactId>joda-time</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!-- Bean Validation API support -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.validation</groupId>
|
||||||
|
<artifactId>validation-api</artifactId>
|
||||||
|
<version>1.1.0.Final</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.RequestPart;
|
|||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
|
||||||
@Api(value = "pet", description = "the pet API")
|
@Api(value = "pet", description = "the pet API")
|
||||||
public interface PetApi {
|
public interface PetApi {
|
||||||
@ -65,7 +65,7 @@ public interface PetApi {
|
|||||||
produces = "application/json",
|
produces = "application/json",
|
||||||
consumes = "application/json",
|
consumes = "application/json",
|
||||||
method = RequestMethod.GET)
|
method = RequestMethod.GET)
|
||||||
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);
|
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);
|
||||||
|
|
||||||
|
|
||||||
@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 = {
|
@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 @@ public interface PetApi {
|
|||||||
produces = "application/json",
|
produces = "application/json",
|
||||||
consumes = "application/json",
|
consumes = "application/json",
|
||||||
method = RequestMethod.GET)
|
method = RequestMethod.GET)
|
||||||
ResponseEntity<List<Pet>> findPetsByTags(@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List<String> tags);
|
ResponseEntity<List<Pet>> findPetsByTags( @NotNull @ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List<String> tags);
|
||||||
|
|
||||||
|
|
||||||
@ApiOperation(value = "Find pet by ID", notes = "Returns a single pet", response = Pet.class, authorizations = {
|
@ApiOperation(value = "Find pet by ID", notes = "Returns a single pet", response = Pet.class, authorizations = {
|
||||||
|
@ -15,7 +15,7 @@ import org.springframework.web.bind.annotation.RequestPart;
|
|||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
|
||||||
@Api(value = "store", description = "the store API")
|
@Api(value = "store", description = "the store API")
|
||||||
public interface StoreApi {
|
public interface StoreApi {
|
||||||
@ -52,7 +52,7 @@ public interface StoreApi {
|
|||||||
produces = "application/json",
|
produces = "application/json",
|
||||||
consumes = "application/json",
|
consumes = "application/json",
|
||||||
method = RequestMethod.GET)
|
method = RequestMethod.GET)
|
||||||
ResponseEntity<Order> getOrderById(@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("orderId") Long orderId);
|
ResponseEntity<Order> getOrderById( @Min(1) @Max(5)@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("orderId") Long orderId);
|
||||||
|
|
||||||
|
|
||||||
@ApiOperation(value = "Place an order for a pet", notes = "", response = Order.class, tags={ "store", })
|
@ApiOperation(value = "Place an order for a pet", notes = "", response = Order.class, tags={ "store", })
|
||||||
|
@ -15,7 +15,7 @@ import org.springframework.web.bind.annotation.RequestPart;
|
|||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
|
||||||
@Api(value = "user", description = "the user API")
|
@Api(value = "user", description = "the user API")
|
||||||
public interface UserApi {
|
public interface UserApi {
|
||||||
@ -81,8 +81,8 @@ public interface UserApi {
|
|||||||
produces = "application/json",
|
produces = "application/json",
|
||||||
consumes = "application/json",
|
consumes = "application/json",
|
||||||
method = RequestMethod.GET)
|
method = RequestMethod.GET)
|
||||||
ResponseEntity<String> loginUser(@ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username,
|
ResponseEntity<String> loginUser( @NotNull @ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username,
|
||||||
@ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password);
|
@NotNull @ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password);
|
||||||
|
|
||||||
|
|
||||||
@ApiOperation(value = "Logs out current logged in user session", notes = "", response = Void.class, tags={ "user", })
|
@ApiOperation(value = "Logs out current logged in user session", notes = "", response = Void.class, tags={ "user", })
|
||||||
|
@ -5,7 +5,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
|||||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import javax.validation.constraints.*;
|
||||||
/**
|
/**
|
||||||
* A category for a pet
|
* A category for a pet
|
||||||
*/
|
*/
|
||||||
|
@ -5,7 +5,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
|||||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import javax.validation.constraints.*;
|
||||||
/**
|
/**
|
||||||
* Describes the result of uploading an image resource
|
* Describes the result of uploading an image resource
|
||||||
*/
|
*/
|
||||||
|
@ -7,7 +7,7 @@ import com.fasterxml.jackson.annotation.JsonValue;
|
|||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
|
import javax.validation.constraints.*;
|
||||||
/**
|
/**
|
||||||
* An order for a pets from the pet store
|
* An order for a pets from the pet store
|
||||||
*/
|
*/
|
||||||
|
@ -10,7 +10,7 @@ import io.swagger.model.Category;
|
|||||||
import io.swagger.model.Tag;
|
import io.swagger.model.Tag;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import javax.validation.constraints.*;
|
||||||
/**
|
/**
|
||||||
* A pet for sale in the pet store
|
* A pet for sale in the pet store
|
||||||
*/
|
*/
|
||||||
@ -114,6 +114,7 @@ public class Pet {
|
|||||||
* @return name
|
* @return name
|
||||||
**/
|
**/
|
||||||
@ApiModelProperty(example = "doggie", required = true, value = "")
|
@ApiModelProperty(example = "doggie", required = true, value = "")
|
||||||
|
@NotNull
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
@ -137,6 +138,7 @@ public class Pet {
|
|||||||
* @return photoUrls
|
* @return photoUrls
|
||||||
**/
|
**/
|
||||||
@ApiModelProperty(required = true, value = "")
|
@ApiModelProperty(required = true, value = "")
|
||||||
|
@NotNull
|
||||||
public List<String> getPhotoUrls() {
|
public List<String> getPhotoUrls() {
|
||||||
return photoUrls;
|
return photoUrls;
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
|||||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import javax.validation.constraints.*;
|
||||||
/**
|
/**
|
||||||
* A tag for a pet
|
* A tag for a pet
|
||||||
*/
|
*/
|
||||||
|
@ -5,7 +5,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
|||||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import javax.validation.constraints.*;
|
||||||
/**
|
/**
|
||||||
* A User who is purchasing from the pet store
|
* A User who is purchasing from the pet store
|
||||||
*/
|
*/
|
||||||
|
73
samples/server/petstore/springboot-delegate/pom.xml
Normal file
73
samples/server/petstore/springboot-delegate/pom.xml
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
<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">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>io.swagger</groupId>
|
||||||
|
<artifactId>swagger-spring</artifactId>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
<name>swagger-spring</name>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
<properties>
|
||||||
|
<java.version>1.7</java.version>
|
||||||
|
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||||
|
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||||
|
<springfox-version>2.5.0</springfox-version>
|
||||||
|
</properties>
|
||||||
|
<parent>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
|
<version>1.3.5.RELEASE</version>
|
||||||
|
</parent>
|
||||||
|
<build>
|
||||||
|
<sourceDirectory>src/main/java</sourceDirectory>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>repackage</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-tomcat</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<!--SpringFox dependencies -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.springfox</groupId>
|
||||||
|
<artifactId>springfox-swagger2</artifactId>
|
||||||
|
<version>${springfox-version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.springfox</groupId>
|
||||||
|
<artifactId>springfox-swagger-ui</artifactId>
|
||||||
|
<version>${springfox-version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||||
|
<artifactId>jackson-datatype-joda</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>joda-time</groupId>
|
||||||
|
<artifactId>joda-time</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!-- Bean Validation API support -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.validation</groupId>
|
||||||
|
<artifactId>validation-api</artifactId>
|
||||||
|
<version>1.1.0.Final</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
Loading…
x
Reference in New Issue
Block a user