forked from loafle/openapi-generator-original
Add bin/jaxrs-resteasy-petstore-server.sh
Add sample into samples/petstore/jaxrs-resteasy Update multipart/form-data ability
This commit is contained in:
parent
d98063083b
commit
d2a3492dd1
31
bin/jaxrs-resteasy-petstore-server.sh
Normal file
31
bin/jaxrs-resteasy-petstore-server.sh
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
SCRIPT="$0"
|
||||||
|
|
||||||
|
while [ -h "$SCRIPT" ] ; do
|
||||||
|
ls=`ls -ld "$SCRIPT"`
|
||||||
|
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||||
|
if expr "$link" : '/.*' > /dev/null; then
|
||||||
|
SCRIPT="$link"
|
||||||
|
else
|
||||||
|
SCRIPT=`dirname "$SCRIPT"`/"$link"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ ! -d "${APP_DIR}" ]; then
|
||||||
|
APP_DIR=`dirname "$SCRIPT"`/..
|
||||||
|
APP_DIR=`cd "${APP_DIR}"; pwd`
|
||||||
|
fi
|
||||||
|
|
||||||
|
executable="./modules/swagger-codegen-cli/target/swagger-codegen-cli.jar"
|
||||||
|
|
||||||
|
if [ ! -f "$executable" ]
|
||||||
|
then
|
||||||
|
mvn clean package
|
||||||
|
fi
|
||||||
|
|
||||||
|
# if you've executed sbt assembly previously it will use that instead.
|
||||||
|
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
|
ags="$@ generate -t modules/swagger-codegen/src/main/resources/JavaJaxRS -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l jaxrs-resteasy -o samples/server/petstore/jaxrs-resteasy"
|
||||||
|
|
||||||
|
java $JAVA_OPTS -jar $executable $ags
|
@ -219,10 +219,19 @@ public class JavaResteasyServerCodegen extends JavaClientCodegen implements Code
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> postProcessOperations(Map<String, Object> objs) {
|
public Map<String, Object> postProcessOperations(Map<String, Object> objs) {
|
||||||
|
|
||||||
Map<String, Object> operations = (Map<String, Object>) objs.get("operations");
|
Map<String, Object> operations = (Map<String, Object>) objs.get("operations");
|
||||||
if (operations != null) {
|
if (operations != null) {
|
||||||
List<CodegenOperation> ops = (List<CodegenOperation>) operations.get("operation");
|
List<CodegenOperation> ops = (List<CodegenOperation>) operations.get("operation");
|
||||||
for (CodegenOperation operation : ops) {
|
for (CodegenOperation operation : ops) {
|
||||||
|
if (operation.hasConsumes == Boolean.TRUE) {
|
||||||
|
Map<String, String> firstType = operation.consumes.get(0);
|
||||||
|
if (firstType != null) {
|
||||||
|
if ("multipart/form-data".equals(firstType.get("mediaType"))) {
|
||||||
|
operation.isMultipart = Boolean.TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
List<CodegenResponse> responses = operation.responses;
|
List<CodegenResponse> responses = operation.responses;
|
||||||
if (responses != null) {
|
if (responses != null) {
|
||||||
for (CodegenResponse resp : responses) {
|
for (CodegenResponse resp : responses) {
|
||||||
|
@ -16,7 +16,8 @@ import javax.ws.rs.core.Context;
|
|||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
import javax.ws.rs.core.SecurityContext;
|
import javax.ws.rs.core.SecurityContext;
|
||||||
import javax.ws.rs.*;
|
import javax.ws.rs.*;
|
||||||
|
{{#operations}}{{#operation}}{{#isMultipart}}import org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataInput;
|
||||||
|
{{/isMultipart}}{{/operation}}{{/operations}}
|
||||||
@Path("/{{baseName}}")
|
@Path("/{{baseName}}")
|
||||||
{{#hasConsumes}}@Consumes({ {{#consumes}}"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} }){{/hasConsumes}}
|
{{#hasConsumes}}@Consumes({ {{#consumes}}"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} }){{/hasConsumes}}
|
||||||
{{#hasProduces}}@Produces({ {{#produces}}"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }){{/hasProduces}}
|
{{#hasProduces}}@Produces({ {{#produces}}"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }){{/hasProduces}}
|
||||||
@ -30,10 +31,9 @@ public class {{classname}} {
|
|||||||
{{#subresourceOperation}}@Path("{{path}}"){{/subresourceOperation}}
|
{{#subresourceOperation}}@Path("{{path}}"){{/subresourceOperation}}
|
||||||
{{#hasConsumes}}@Consumes({ {{#consumes}}"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} }){{/hasConsumes}}
|
{{#hasConsumes}}@Consumes({ {{#consumes}}"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} }){{/hasConsumes}}
|
||||||
{{#hasProduces}}@Produces({ {{#produces}}"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }){{/hasProduces}}
|
{{#hasProduces}}@Produces({ {{#produces}}"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }){{/hasProduces}}
|
||||||
|
public Response {{nickname}}({{#isMultipart}}MultipartFormDataInput input,{{/isMultipart}}{{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{^isMultipart}}{{>formParams}},{{/isMultipart}}{{#isMultipart}}{{^isFormParam}},{{/isFormParam}}{{/isMultipart}}{{/allParams}}@Context SecurityContext securityContext)
|
||||||
public Response {{nickname}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}},{{/allParams}}@Context SecurityContext securityContext)
|
|
||||||
throws NotFoundException {
|
throws NotFoundException {
|
||||||
return delegate.{{nickname}}({{#allParams}}{{#isFile}}fileDetail{{/isFile}}{{^isFile}}{{paramName}}{{/isFile}},{{/allParams}}securityContext);
|
return delegate.{{nickname}}({{#isMultipart}}input,{{/isMultipart}}{{#allParams}}{{^isMultipart}}{{paramName}},{{/isMultipart}}{{#isMultipart}}{{^isFormParam}}{{paramName}},{{/isFormParam}}{{/isMultipart}}{{/allParams}}securityContext);
|
||||||
}
|
}
|
||||||
{{/operation}}
|
{{/operation}}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,8 @@ package {{package}};
|
|||||||
|
|
||||||
import {{package}}.*;
|
import {{package}}.*;
|
||||||
import {{modelPackage}}.*;
|
import {{modelPackage}}.*;
|
||||||
|
{{#operations}}{{#operation}}{{#isMultipart}}import org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataInput;
|
||||||
|
{{/isMultipart}}{{/operation}}{{/operations}}
|
||||||
|
|
||||||
{{#imports}}import {{import}};
|
{{#imports}}import {{import}};
|
||||||
{{/imports}}
|
{{/imports}}
|
||||||
@ -18,7 +20,7 @@ import javax.ws.rs.core.SecurityContext;
|
|||||||
{{#operations}}
|
{{#operations}}
|
||||||
public abstract class {{classname}}Service {
|
public abstract class {{classname}}Service {
|
||||||
{{#operation}}
|
{{#operation}}
|
||||||
public abstract Response {{nickname}}({{#allParams}}{{>serviceQueryParams}}{{>servicePathParams}}{{>serviceHeaderParams}}{{>serviceBodyParams}}{{>serviceFormParams}},{{/allParams}}SecurityContext securityContext)
|
public abstract Response {{nickname}}({{#isMultipart}}MultipartFormDataInput input,{{/isMultipart}}{{#allParams}}{{>serviceQueryParams}}{{>servicePathParams}}{{>serviceHeaderParams}}{{>serviceBodyParams}}{{^isMultipart}}{{>serviceFormParams}},{{/isMultipart}}{{#isMultipart}}{{^isFormParam}},{{/isFormParam}}{{/isMultipart}}{{/allParams}}SecurityContext securityContext)
|
||||||
throws NotFoundException;
|
throws NotFoundException;
|
||||||
{{/operation}}
|
{{/operation}}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,8 @@ package {{package}}.impl;
|
|||||||
|
|
||||||
import {{package}}.*;
|
import {{package}}.*;
|
||||||
import {{modelPackage}}.*;
|
import {{modelPackage}}.*;
|
||||||
|
{{#operations}}{{#operation}}{{#isMultipart}}import org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataInput;
|
||||||
|
{{/isMultipart}}{{/operation}}{{/operations}}
|
||||||
|
|
||||||
{{#imports}}import {{import}};
|
{{#imports}}import {{import}};
|
||||||
{{/imports}}
|
{{/imports}}
|
||||||
@ -19,7 +21,7 @@ import javax.ws.rs.core.SecurityContext;
|
|||||||
public class {{classname}}ServiceImpl extends {{classname}}Service {
|
public class {{classname}}ServiceImpl extends {{classname}}Service {
|
||||||
{{#operation}}
|
{{#operation}}
|
||||||
@Override
|
@Override
|
||||||
public Response {{nickname}}({{#allParams}}{{>serviceQueryParams}}{{>servicePathParams}}{{>serviceHeaderParams}}{{>serviceBodyParams}}{{>serviceFormParams}},{{/allParams}}SecurityContext securityContext)
|
public Response {{nickname}}({{#isMultipart}}MultipartFormDataInput input,{{/isMultipart}}{{#allParams}}{{>serviceQueryParams}}{{>servicePathParams}}{{>serviceHeaderParams}}{{>serviceBodyParams}}{{^isMultipart}}{{>serviceFormParams}},{{/isMultipart}}{{#isMultipart}}{{^isFormParam}},{{/isFormParam}}{{/isMultipart}}{{/allParams}}SecurityContext securityContext)
|
||||||
throws NotFoundException {
|
throws NotFoundException {
|
||||||
// do some magic!
|
// do some magic!
|
||||||
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||||
|
@ -1,2 +1 @@
|
|||||||
{{#isFormParam}}{{#notFile}}@FormParam("{{paramName}}") {{{dataType}}} {{paramName}}{{/notFile}}{{#isFile}} @FormDataParam("file") InputStream inputStream,
|
{{#isFormParam}}{{#notFile}}@FormParam("{{paramName}}") {{{dataType}}} {{paramName}}{{/notFile}}{{/isFormParam}}
|
||||||
@FormDataParam("file") FormDataContentDisposition fileDetail{{/isFile}}{{/isFormParam}}
|
|
@ -11,6 +11,7 @@ dependencies {
|
|||||||
providedCompile 'org.jboss.resteasy:resteasy-jaxrs:3.0.11.Final'
|
providedCompile 'org.jboss.resteasy:resteasy-jaxrs:3.0.11.Final'
|
||||||
providedCompile 'org.jboss.resteasy:jaxrs-api:3.0.11.Final'
|
providedCompile 'org.jboss.resteasy:jaxrs-api:3.0.11.Final'
|
||||||
providedCompile 'org.jboss.resteasy:resteasy-validator-provider-11:3.0.11.Final'
|
providedCompile 'org.jboss.resteasy:resteasy-validator-provider-11:3.0.11.Final'
|
||||||
|
providedCompile 'org.jboss.resteasy:resteasy-multipart-provider:3.0.11.Final'
|
||||||
providedCompile 'javax.annotation:javax.annotation-api:1.2'
|
providedCompile 'javax.annotation:javax.annotation-api:1.2'
|
||||||
providedCompile 'org.jboss.spec.javax.servlet:jboss-servlet-api_3.0_spec:1.0.0.Final'
|
providedCompile 'org.jboss.spec.javax.servlet:jboss-servlet-api_3.0_spec:1.0.0.Final'
|
||||||
compile 'org.jboss.resteasy:resteasy-jackson2-provider:3.0.11.Final'
|
compile 'org.jboss.resteasy:resteasy-jackson2-provider:3.0.11.Final'
|
||||||
|
@ -79,6 +79,12 @@
|
|||||||
<version>${resteasy-version}</version>
|
<version>${resteasy-version}</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jboss.resteasy</groupId>
|
||||||
|
<artifactId>resteasy-multipart-provider</artifactId>
|
||||||
|
<version>${resteasy-version}</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jboss.resteasy</groupId>
|
<groupId>org.jboss.resteasy</groupId>
|
||||||
<artifactId>resteasy-jackson2-provider</artifactId>
|
<artifactId>resteasy-jackson2-provider</artifactId>
|
||||||
|
23
samples/server/petstore/jaxrs-resteasy/README.md
Normal file
23
samples/server/petstore/jaxrs-resteasy/README.md
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# Swagger generated server
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
This server was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. By using the
|
||||||
|
[OpenAPI-Spec](https://github.com/swagger-api/swagger-core/wiki) from a remote server, you can easily generate a server stub. This
|
||||||
|
is an example of building a swagger-enabled JAX-RS server.
|
||||||
|
|
||||||
|
This example uses the [JAX-RS](https://jax-rs-spec.java.net/) framework.
|
||||||
|
|
||||||
|
To run the server, please execute the following:
|
||||||
|
|
||||||
|
```
|
||||||
|
mvn clean package jetty:run
|
||||||
|
```
|
||||||
|
|
||||||
|
You can then view the swagger listing here:
|
||||||
|
|
||||||
|
```
|
||||||
|
http://localhost:8080/v2/swagger.json
|
||||||
|
```
|
||||||
|
|
||||||
|
Note that if you have configured the `host` to be something other than localhost, the calls through
|
||||||
|
swagger-ui will be directed to that host and not localhost!
|
32
samples/server/petstore/jaxrs-resteasy/build.gradle
Normal file
32
samples/server/petstore/jaxrs-resteasy/build.gradle
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
apply plugin: 'war'
|
||||||
|
|
||||||
|
project.version = "1.0.0"
|
||||||
|
project.group = "io.swagger"
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
providedCompile 'org.jboss.resteasy:resteasy-jaxrs:3.0.11.Final'
|
||||||
|
providedCompile 'org.jboss.resteasy:jaxrs-api:3.0.11.Final'
|
||||||
|
providedCompile 'org.jboss.resteasy:resteasy-validator-provider-11:3.0.11.Final'
|
||||||
|
providedCompile 'org.jboss.resteasy:resteasy-multipart-provider:3.0.11.Final'
|
||||||
|
providedCompile 'javax.annotation:javax.annotation-api:1.2'
|
||||||
|
providedCompile 'org.jboss.spec.javax.servlet:jboss-servlet-api_3.0_spec:1.0.0.Final'
|
||||||
|
compile 'org.jboss.resteasy:resteasy-jackson2-provider:3.0.11.Final'
|
||||||
|
|
||||||
|
// compile 'com.fasterxml.jackson.datatype:jackson-datatype-joda:2.4.1'
|
||||||
|
// compile 'joda-time:joda-time:2.7'
|
||||||
|
|
||||||
|
testCompile 'junit:junit:4.12',
|
||||||
|
'org.hamcrest:hamcrest-core:1.3'
|
||||||
|
}
|
||||||
|
|
||||||
|
sourceSets {
|
||||||
|
main {
|
||||||
|
java {
|
||||||
|
srcDir 'src/gen/java'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
155
samples/server/petstore/jaxrs-resteasy/pom.xml
Normal file
155
samples/server/petstore/jaxrs-resteasy/pom.xml
Normal file
@ -0,0 +1,155 @@
|
|||||||
|
<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-jaxrs-resteasy-server</artifactId>
|
||||||
|
<packaging>war</packaging>
|
||||||
|
<name>swagger-jaxrs-resteasy-server</name>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
<build>
|
||||||
|
<sourceDirectory>src/main/java</sourceDirectory>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-war-plugin</artifactId>
|
||||||
|
<version>2.1.1</version>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-failsafe-plugin</artifactId>
|
||||||
|
<version>2.6</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>integration-test</goal>
|
||||||
|
<goal>verify</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
|
<artifactId>build-helper-maven-plugin</artifactId>
|
||||||
|
<version>1.9.1</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>add-source</id>
|
||||||
|
<phase>generate-sources</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>add-source</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<sources>
|
||||||
|
<source>
|
||||||
|
src/gen/java</source>
|
||||||
|
</sources>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.slf4j</groupId>
|
||||||
|
<artifactId>slf4j-log4j12</artifactId>
|
||||||
|
<version>${slf4j-version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.servlet</groupId>
|
||||||
|
<artifactId>servlet-api</artifactId>
|
||||||
|
<version>${servlet-api-version}</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jboss.resteasy</groupId>
|
||||||
|
<artifactId>resteasy-jaxrs</artifactId>
|
||||||
|
<version>${resteasy-version}</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jboss.resteasy</groupId>
|
||||||
|
<artifactId>jaxrs-api</artifactId>
|
||||||
|
<version>${resteasy-version}</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jboss.resteasy</groupId>
|
||||||
|
<artifactId>resteasy-validator-provider-11</artifactId>
|
||||||
|
<version>${resteasy-version}</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jboss.resteasy</groupId>
|
||||||
|
<artifactId>resteasy-multipart-provider</artifactId>
|
||||||
|
<version>${resteasy-version}</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jboss.resteasy</groupId>
|
||||||
|
<artifactId>resteasy-jackson2-provider</artifactId>
|
||||||
|
<version>${resteasy-version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.annotation</groupId>
|
||||||
|
<artifactId>javax.annotation-api</artifactId>
|
||||||
|
<version>1.2</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||||
|
<artifactId>jackson-datatype-joda</artifactId>
|
||||||
|
<version>2.4.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>joda-time</groupId>
|
||||||
|
<artifactId>joda-time</artifactId>
|
||||||
|
<version>2.7</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
<version>${junit-version}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.testng</groupId>
|
||||||
|
<artifactId>testng</artifactId>
|
||||||
|
<version>6.8.8</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>snakeyaml</artifactId>
|
||||||
|
<groupId>org.yaml</groupId>
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>bsh</artifactId>
|
||||||
|
<groupId>org.beanshell</groupId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
<repositories>
|
||||||
|
<repository>
|
||||||
|
<id>sonatype-snapshots</id>
|
||||||
|
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||||
|
<snapshots>
|
||||||
|
<enabled>true</enabled>
|
||||||
|
</snapshots>
|
||||||
|
</repository>
|
||||||
|
</repositories>
|
||||||
|
<properties>
|
||||||
|
<swagger-core-version>1.5.4</swagger-core-version>
|
||||||
|
<jetty-version>9.2.9.v20150224</jetty-version>
|
||||||
|
<resteasy-version>3.0.11.Final</resteasy-version>
|
||||||
|
<slf4j-version>1.6.3</slf4j-version>
|
||||||
|
<junit-version>4.8.1</junit-version>
|
||||||
|
<servlet-api-version>2.5</servlet-api-version>
|
||||||
|
</properties>
|
||||||
|
</project>
|
1
samples/server/petstore/jaxrs-resteasy/settings.gradle
Normal file
1
samples/server/petstore/jaxrs-resteasy/settings.gradle
Normal file
@ -0,0 +1 @@
|
|||||||
|
rootProject.name = "swagger-jaxrs-resteasy-server"
|
@ -0,0 +1,10 @@
|
|||||||
|
package io.swagger.api;
|
||||||
|
|
||||||
|
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-02-04T01:58:20.368+07:00")
|
||||||
|
public class ApiException extends Exception{
|
||||||
|
private int code;
|
||||||
|
public ApiException (int code, String msg) {
|
||||||
|
super(msg);
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
package io.swagger.api;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import javax.servlet.*;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-02-04T01:58:20.368+07:00")
|
||||||
|
public class ApiOriginFilter implements javax.servlet.Filter {
|
||||||
|
public void doFilter(ServletRequest request, ServletResponse response,
|
||||||
|
FilterChain chain) throws IOException, ServletException {
|
||||||
|
HttpServletResponse res = (HttpServletResponse) response;
|
||||||
|
res.addHeader("Access-Control-Allow-Origin", "*");
|
||||||
|
res.addHeader("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT");
|
||||||
|
res.addHeader("Access-Control-Allow-Headers", "Content-Type");
|
||||||
|
chain.doFilter(request, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void destroy() {}
|
||||||
|
|
||||||
|
public void init(FilterConfig filterConfig) throws ServletException {}
|
||||||
|
}
|
@ -0,0 +1,69 @@
|
|||||||
|
package io.swagger.api;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlTransient;
|
||||||
|
|
||||||
|
@javax.xml.bind.annotation.XmlRootElement
|
||||||
|
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-02-04T01:58:20.368+07:00")
|
||||||
|
public class ApiResponseMessage {
|
||||||
|
public static final int ERROR = 1;
|
||||||
|
public static final int WARNING = 2;
|
||||||
|
public static final int INFO = 3;
|
||||||
|
public static final int OK = 4;
|
||||||
|
public static final int TOO_BUSY = 5;
|
||||||
|
|
||||||
|
int code;
|
||||||
|
String type;
|
||||||
|
String message;
|
||||||
|
|
||||||
|
public ApiResponseMessage(){}
|
||||||
|
|
||||||
|
public ApiResponseMessage(int code, String message){
|
||||||
|
this.code = code;
|
||||||
|
switch(code){
|
||||||
|
case ERROR:
|
||||||
|
setType("error");
|
||||||
|
break;
|
||||||
|
case WARNING:
|
||||||
|
setType("warning");
|
||||||
|
break;
|
||||||
|
case INFO:
|
||||||
|
setType("info");
|
||||||
|
break;
|
||||||
|
case OK:
|
||||||
|
setType("ok");
|
||||||
|
break;
|
||||||
|
case TOO_BUSY:
|
||||||
|
setType("too busy");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
setType("unknown");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlTransient
|
||||||
|
public int getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCode(int code) {
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMessage() {
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMessage(String message) {
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,10 @@
|
|||||||
|
package io.swagger.api;
|
||||||
|
|
||||||
|
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-02-04T01:58:20.368+07:00")
|
||||||
|
public class NotFoundException extends ApiException {
|
||||||
|
private int code;
|
||||||
|
public NotFoundException (int code, String msg) {
|
||||||
|
super(code, msg);
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,113 @@
|
|||||||
|
package io.swagger.api;
|
||||||
|
|
||||||
|
import io.swagger.model.*;
|
||||||
|
import io.swagger.api.PetApiService;
|
||||||
|
import io.swagger.api.factories.PetApiServiceFactory;
|
||||||
|
|
||||||
|
import io.swagger.model.Pet;
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import io.swagger.api.NotFoundException;
|
||||||
|
|
||||||
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
import javax.ws.rs.core.Context;
|
||||||
|
import javax.ws.rs.core.Response;
|
||||||
|
import javax.ws.rs.core.SecurityContext;
|
||||||
|
import javax.ws.rs.*;
|
||||||
|
import org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataInput;
|
||||||
|
|
||||||
|
@Path("/pet")
|
||||||
|
|
||||||
|
|
||||||
|
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-02-04T01:58:20.368+07:00")
|
||||||
|
|
||||||
|
public class PetApi {
|
||||||
|
private final PetApiService delegate = PetApiServiceFactory.getPetApi();
|
||||||
|
|
||||||
|
|
||||||
|
@PUT
|
||||||
|
|
||||||
|
@Consumes({ "application/json", "application/xml" })
|
||||||
|
@Produces({ "application/json", "application/xml" })
|
||||||
|
public Response updatePet( Pet body,@Context SecurityContext securityContext)
|
||||||
|
throws NotFoundException {
|
||||||
|
return delegate.updatePet(body,securityContext);
|
||||||
|
}
|
||||||
|
|
||||||
|
@POST
|
||||||
|
|
||||||
|
@Consumes({ "application/json", "application/xml" })
|
||||||
|
@Produces({ "application/json", "application/xml" })
|
||||||
|
public Response addPet( Pet body,@Context SecurityContext securityContext)
|
||||||
|
throws NotFoundException {
|
||||||
|
return delegate.addPet(body,securityContext);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Path("/findByStatus")
|
||||||
|
|
||||||
|
@Produces({ "application/json", "application/xml" })
|
||||||
|
public Response findPetsByStatus( @QueryParam("status") List<String> status,@Context SecurityContext securityContext)
|
||||||
|
throws NotFoundException {
|
||||||
|
return delegate.findPetsByStatus(status,securityContext);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Path("/findByTags")
|
||||||
|
|
||||||
|
@Produces({ "application/json", "application/xml" })
|
||||||
|
public Response findPetsByTags( @QueryParam("tags") List<String> tags,@Context SecurityContext securityContext)
|
||||||
|
throws NotFoundException {
|
||||||
|
return delegate.findPetsByTags(tags,securityContext);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Path("/{petId}")
|
||||||
|
|
||||||
|
@Produces({ "application/json", "application/xml" })
|
||||||
|
public Response getPetById( @PathParam("petId") Long petId,@Context SecurityContext securityContext)
|
||||||
|
throws NotFoundException {
|
||||||
|
return delegate.getPetById(petId,securityContext);
|
||||||
|
}
|
||||||
|
|
||||||
|
@POST
|
||||||
|
@Path("/{petId}")
|
||||||
|
@Consumes({ "application/x-www-form-urlencoded" })
|
||||||
|
@Produces({ "application/json", "application/xml" })
|
||||||
|
public Response updatePetWithForm( @PathParam("petId") String petId,@FormParam("name") String name,@FormParam("status") String status,@Context SecurityContext securityContext)
|
||||||
|
throws NotFoundException {
|
||||||
|
return delegate.updatePetWithForm(petId,name,status,securityContext);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DELETE
|
||||||
|
@Path("/{petId}")
|
||||||
|
|
||||||
|
@Produces({ "application/json", "application/xml" })
|
||||||
|
public Response deletePet( @PathParam("petId") Long petId,@HeaderParam("api_key") String apiKey,@Context SecurityContext securityContext)
|
||||||
|
throws NotFoundException {
|
||||||
|
return delegate.deletePet(petId,apiKey,securityContext);
|
||||||
|
}
|
||||||
|
|
||||||
|
@POST
|
||||||
|
@Path("/{petId}/uploadImage")
|
||||||
|
@Consumes({ "multipart/form-data" })
|
||||||
|
@Produces({ "application/json", "application/xml" })
|
||||||
|
public Response uploadFile(MultipartFormDataInput input, @PathParam("petId") Long petId,@Context SecurityContext securityContext)
|
||||||
|
throws NotFoundException {
|
||||||
|
return delegate.uploadFile(input,petId,securityContext);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Path("/{petId}?testing_byte_array=true")
|
||||||
|
|
||||||
|
@Produces({ "application/json", "application/xml" })
|
||||||
|
public Response getPetByIdWithByteArray( @PathParam("petId") Long petId,@Context SecurityContext securityContext)
|
||||||
|
throws NotFoundException {
|
||||||
|
return delegate.getPetByIdWithByteArray(petId,securityContext);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,52 @@
|
|||||||
|
package io.swagger.api;
|
||||||
|
|
||||||
|
import io.swagger.api.*;
|
||||||
|
import io.swagger.model.*;
|
||||||
|
import org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataInput;
|
||||||
|
|
||||||
|
|
||||||
|
import io.swagger.model.Pet;
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import io.swagger.api.NotFoundException;
|
||||||
|
|
||||||
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
import javax.ws.rs.core.Response;
|
||||||
|
import javax.ws.rs.core.SecurityContext;
|
||||||
|
|
||||||
|
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-02-04T01:58:20.368+07:00")
|
||||||
|
|
||||||
|
public abstract class PetApiService {
|
||||||
|
|
||||||
|
public abstract Response updatePet(Pet body,SecurityContext securityContext)
|
||||||
|
throws NotFoundException;
|
||||||
|
|
||||||
|
public abstract Response addPet(Pet body,SecurityContext securityContext)
|
||||||
|
throws NotFoundException;
|
||||||
|
|
||||||
|
public abstract Response findPetsByStatus(List<String> status,SecurityContext securityContext)
|
||||||
|
throws NotFoundException;
|
||||||
|
|
||||||
|
public abstract Response findPetsByTags(List<String> tags,SecurityContext securityContext)
|
||||||
|
throws NotFoundException;
|
||||||
|
|
||||||
|
public abstract Response getPetById(Long petId,SecurityContext securityContext)
|
||||||
|
throws NotFoundException;
|
||||||
|
|
||||||
|
public abstract Response updatePetWithForm(String petId,String name,String status,SecurityContext securityContext)
|
||||||
|
throws NotFoundException;
|
||||||
|
|
||||||
|
public abstract Response deletePet(Long petId,String apiKey,SecurityContext securityContext)
|
||||||
|
throws NotFoundException;
|
||||||
|
|
||||||
|
public abstract Response uploadFile(MultipartFormDataInput input,Long petId,SecurityContext securityContext)
|
||||||
|
throws NotFoundException;
|
||||||
|
|
||||||
|
public abstract Response getPetByIdWithByteArray(Long petId,SecurityContext securityContext)
|
||||||
|
throws NotFoundException;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,38 @@
|
|||||||
|
package io.swagger.api;
|
||||||
|
|
||||||
|
import io.swagger.model.*;
|
||||||
|
import io.swagger.api.PettestingByteArraytrueApiService;
|
||||||
|
import io.swagger.api.factories.PettestingByteArraytrueApiServiceFactory;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import io.swagger.api.NotFoundException;
|
||||||
|
|
||||||
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
import javax.ws.rs.core.Context;
|
||||||
|
import javax.ws.rs.core.Response;
|
||||||
|
import javax.ws.rs.core.SecurityContext;
|
||||||
|
import javax.ws.rs.*;
|
||||||
|
|
||||||
|
@Path("/pet?testing_byte_array=true")
|
||||||
|
|
||||||
|
|
||||||
|
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-02-04T01:58:20.368+07:00")
|
||||||
|
|
||||||
|
public class PettestingByteArraytrueApi {
|
||||||
|
private final PettestingByteArraytrueApiService delegate = PettestingByteArraytrueApiServiceFactory.getPettestingByteArraytrueApi();
|
||||||
|
|
||||||
|
|
||||||
|
@POST
|
||||||
|
|
||||||
|
@Consumes({ "application/json", "application/xml" })
|
||||||
|
@Produces({ "application/json", "application/xml" })
|
||||||
|
public Response addPetUsingByteArray( byte[] body,@Context SecurityContext securityContext)
|
||||||
|
throws NotFoundException {
|
||||||
|
return delegate.addPetUsingByteArray(body,securityContext);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,25 @@
|
|||||||
|
package io.swagger.api;
|
||||||
|
|
||||||
|
import io.swagger.api.*;
|
||||||
|
import io.swagger.model.*;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import io.swagger.api.NotFoundException;
|
||||||
|
|
||||||
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
import javax.ws.rs.core.Response;
|
||||||
|
import javax.ws.rs.core.SecurityContext;
|
||||||
|
|
||||||
|
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-02-04T01:58:20.368+07:00")
|
||||||
|
|
||||||
|
public abstract class PettestingByteArraytrueApiService {
|
||||||
|
|
||||||
|
public abstract Response addPetUsingByteArray(byte[] body,SecurityContext securityContext)
|
||||||
|
throws NotFoundException;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,9 @@
|
|||||||
|
package io.swagger.api;
|
||||||
|
|
||||||
|
import javax.ws.rs.ApplicationPath;
|
||||||
|
import javax.ws.rs.core.Application;
|
||||||
|
|
||||||
|
@ApplicationPath("/")
|
||||||
|
public class RestApplication extends Application {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,67 @@
|
|||||||
|
package io.swagger.api;
|
||||||
|
|
||||||
|
import io.swagger.model.*;
|
||||||
|
import io.swagger.api.StoreApiService;
|
||||||
|
import io.swagger.api.factories.StoreApiServiceFactory;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import io.swagger.model.Order;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import io.swagger.api.NotFoundException;
|
||||||
|
|
||||||
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
import javax.ws.rs.core.Context;
|
||||||
|
import javax.ws.rs.core.Response;
|
||||||
|
import javax.ws.rs.core.SecurityContext;
|
||||||
|
import javax.ws.rs.*;
|
||||||
|
|
||||||
|
@Path("/store")
|
||||||
|
|
||||||
|
|
||||||
|
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-02-04T01:58:20.368+07:00")
|
||||||
|
|
||||||
|
public class StoreApi {
|
||||||
|
private final StoreApiService delegate = StoreApiServiceFactory.getStoreApi();
|
||||||
|
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Path("/inventory")
|
||||||
|
|
||||||
|
@Produces({ "application/json", "application/xml" })
|
||||||
|
public Response getInventory(@Context SecurityContext securityContext)
|
||||||
|
throws NotFoundException {
|
||||||
|
return delegate.getInventory(securityContext);
|
||||||
|
}
|
||||||
|
|
||||||
|
@POST
|
||||||
|
@Path("/order")
|
||||||
|
|
||||||
|
@Produces({ "application/json", "application/xml" })
|
||||||
|
public Response placeOrder( Order body,@Context SecurityContext securityContext)
|
||||||
|
throws NotFoundException {
|
||||||
|
return delegate.placeOrder(body,securityContext);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Path("/order/{orderId}")
|
||||||
|
|
||||||
|
@Produces({ "application/json", "application/xml" })
|
||||||
|
public Response getOrderById( @PathParam("orderId") String orderId,@Context SecurityContext securityContext)
|
||||||
|
throws NotFoundException {
|
||||||
|
return delegate.getOrderById(orderId,securityContext);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DELETE
|
||||||
|
@Path("/order/{orderId}")
|
||||||
|
|
||||||
|
@Produces({ "application/json", "application/xml" })
|
||||||
|
public Response deleteOrder( @PathParam("orderId") String orderId,@Context SecurityContext securityContext)
|
||||||
|
throws NotFoundException {
|
||||||
|
return delegate.deleteOrder(orderId,securityContext);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,36 @@
|
|||||||
|
package io.swagger.api;
|
||||||
|
|
||||||
|
import io.swagger.api.*;
|
||||||
|
import io.swagger.model.*;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import io.swagger.model.Order;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import io.swagger.api.NotFoundException;
|
||||||
|
|
||||||
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
import javax.ws.rs.core.Response;
|
||||||
|
import javax.ws.rs.core.SecurityContext;
|
||||||
|
|
||||||
|
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-02-04T01:58:20.368+07:00")
|
||||||
|
|
||||||
|
public abstract class StoreApiService {
|
||||||
|
|
||||||
|
public abstract Response getInventory(SecurityContext securityContext)
|
||||||
|
throws NotFoundException;
|
||||||
|
|
||||||
|
public abstract Response placeOrder(Order body,SecurityContext securityContext)
|
||||||
|
throws NotFoundException;
|
||||||
|
|
||||||
|
public abstract Response getOrderById(String orderId,SecurityContext securityContext)
|
||||||
|
throws NotFoundException;
|
||||||
|
|
||||||
|
public abstract Response deleteOrder(String orderId,SecurityContext securityContext)
|
||||||
|
throws NotFoundException;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,42 @@
|
|||||||
|
package io.swagger.api;
|
||||||
|
|
||||||
|
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-02-04T01:58:20.368+07:00")
|
||||||
|
public class StringUtil {
|
||||||
|
/**
|
||||||
|
* Check if the given array contains the given value (with case-insensitive comparison).
|
||||||
|
*
|
||||||
|
* @param array The array
|
||||||
|
* @param value The value to search
|
||||||
|
* @return true if the array contains the value
|
||||||
|
*/
|
||||||
|
public static boolean containsIgnoreCase(String[] array, String value) {
|
||||||
|
for (String str : array) {
|
||||||
|
if (value == null && str == null) return true;
|
||||||
|
if (value != null && value.equalsIgnoreCase(str)) return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Join an array of strings with the given separator.
|
||||||
|
* <p>
|
||||||
|
* Note: This might be replaced by utility method from commons-lang or guava someday
|
||||||
|
* if one of those libraries is added as dependency.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @param array The array of strings
|
||||||
|
* @param separator The separator
|
||||||
|
* @return the resulting string
|
||||||
|
*/
|
||||||
|
public static String join(String[] array, String separator) {
|
||||||
|
int len = array.length;
|
||||||
|
if (len == 0) return "";
|
||||||
|
|
||||||
|
StringBuilder out = new StringBuilder();
|
||||||
|
out.append(array[0]);
|
||||||
|
for (int i = 1; i < len; i++) {
|
||||||
|
out.append(separator).append(array[i]);
|
||||||
|
}
|
||||||
|
return out.toString();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,103 @@
|
|||||||
|
package io.swagger.api;
|
||||||
|
|
||||||
|
import io.swagger.model.*;
|
||||||
|
import io.swagger.api.UserApiService;
|
||||||
|
import io.swagger.api.factories.UserApiServiceFactory;
|
||||||
|
|
||||||
|
import io.swagger.model.User;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import io.swagger.api.NotFoundException;
|
||||||
|
|
||||||
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
import javax.ws.rs.core.Context;
|
||||||
|
import javax.ws.rs.core.Response;
|
||||||
|
import javax.ws.rs.core.SecurityContext;
|
||||||
|
import javax.ws.rs.*;
|
||||||
|
|
||||||
|
@Path("/user")
|
||||||
|
|
||||||
|
|
||||||
|
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-02-04T01:58:20.368+07:00")
|
||||||
|
|
||||||
|
public class UserApi {
|
||||||
|
private final UserApiService delegate = UserApiServiceFactory.getUserApi();
|
||||||
|
|
||||||
|
|
||||||
|
@POST
|
||||||
|
|
||||||
|
|
||||||
|
@Produces({ "application/json", "application/xml" })
|
||||||
|
public Response createUser( User body,@Context SecurityContext securityContext)
|
||||||
|
throws NotFoundException {
|
||||||
|
return delegate.createUser(body,securityContext);
|
||||||
|
}
|
||||||
|
|
||||||
|
@POST
|
||||||
|
@Path("/createWithArray")
|
||||||
|
|
||||||
|
@Produces({ "application/json", "application/xml" })
|
||||||
|
public Response createUsersWithArrayInput( List<User> body,@Context SecurityContext securityContext)
|
||||||
|
throws NotFoundException {
|
||||||
|
return delegate.createUsersWithArrayInput(body,securityContext);
|
||||||
|
}
|
||||||
|
|
||||||
|
@POST
|
||||||
|
@Path("/createWithList")
|
||||||
|
|
||||||
|
@Produces({ "application/json", "application/xml" })
|
||||||
|
public Response createUsersWithListInput( List<User> body,@Context SecurityContext securityContext)
|
||||||
|
throws NotFoundException {
|
||||||
|
return delegate.createUsersWithListInput(body,securityContext);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Path("/login")
|
||||||
|
|
||||||
|
@Produces({ "application/json", "application/xml" })
|
||||||
|
public Response loginUser( @QueryParam("username") String username, @QueryParam("password") String password,@Context SecurityContext securityContext)
|
||||||
|
throws NotFoundException {
|
||||||
|
return delegate.loginUser(username,password,securityContext);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Path("/logout")
|
||||||
|
|
||||||
|
@Produces({ "application/json", "application/xml" })
|
||||||
|
public Response logoutUser(@Context SecurityContext securityContext)
|
||||||
|
throws NotFoundException {
|
||||||
|
return delegate.logoutUser(securityContext);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Path("/{username}")
|
||||||
|
|
||||||
|
@Produces({ "application/json", "application/xml" })
|
||||||
|
public Response getUserByName( @PathParam("username") String username,@Context SecurityContext securityContext)
|
||||||
|
throws NotFoundException {
|
||||||
|
return delegate.getUserByName(username,securityContext);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PUT
|
||||||
|
@Path("/{username}")
|
||||||
|
|
||||||
|
@Produces({ "application/json", "application/xml" })
|
||||||
|
public Response updateUser( @PathParam("username") String username, User body,@Context SecurityContext securityContext)
|
||||||
|
throws NotFoundException {
|
||||||
|
return delegate.updateUser(username,body,securityContext);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DELETE
|
||||||
|
@Path("/{username}")
|
||||||
|
|
||||||
|
@Produces({ "application/json", "application/xml" })
|
||||||
|
public Response deleteUser( @PathParam("username") String username,@Context SecurityContext securityContext)
|
||||||
|
throws NotFoundException {
|
||||||
|
return delegate.deleteUser(username,securityContext);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,48 @@
|
|||||||
|
package io.swagger.api;
|
||||||
|
|
||||||
|
import io.swagger.api.*;
|
||||||
|
import io.swagger.model.*;
|
||||||
|
|
||||||
|
|
||||||
|
import io.swagger.model.User;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import io.swagger.api.NotFoundException;
|
||||||
|
|
||||||
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
import javax.ws.rs.core.Response;
|
||||||
|
import javax.ws.rs.core.SecurityContext;
|
||||||
|
|
||||||
|
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-02-04T01:58:20.368+07:00")
|
||||||
|
|
||||||
|
public abstract class UserApiService {
|
||||||
|
|
||||||
|
public abstract Response createUser(User body,SecurityContext securityContext)
|
||||||
|
throws NotFoundException;
|
||||||
|
|
||||||
|
public abstract Response createUsersWithArrayInput(List<User> body,SecurityContext securityContext)
|
||||||
|
throws NotFoundException;
|
||||||
|
|
||||||
|
public abstract Response createUsersWithListInput(List<User> body,SecurityContext securityContext)
|
||||||
|
throws NotFoundException;
|
||||||
|
|
||||||
|
public abstract Response loginUser(String username,String password,SecurityContext securityContext)
|
||||||
|
throws NotFoundException;
|
||||||
|
|
||||||
|
public abstract Response logoutUser(SecurityContext securityContext)
|
||||||
|
throws NotFoundException;
|
||||||
|
|
||||||
|
public abstract Response getUserByName(String username,SecurityContext securityContext)
|
||||||
|
throws NotFoundException;
|
||||||
|
|
||||||
|
public abstract Response updateUser(String username,User body,SecurityContext securityContext)
|
||||||
|
throws NotFoundException;
|
||||||
|
|
||||||
|
public abstract Response deleteUser(String username,SecurityContext securityContext)
|
||||||
|
throws NotFoundException;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,86 @@
|
|||||||
|
package io.swagger.model;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonValue;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-02-04T01:58:20.368+07:00")
|
||||||
|
public class Category {
|
||||||
|
|
||||||
|
private Long id = null;
|
||||||
|
private String name = null;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
**/
|
||||||
|
|
||||||
|
@JsonProperty("id")
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
**/
|
||||||
|
|
||||||
|
@JsonProperty("name")
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (o == null || getClass() != o.getClass()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Category category = (Category) o;
|
||||||
|
return Objects.equals(id, category.id) &&
|
||||||
|
Objects.equals(name, category.name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(id, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append("class Category {\n");
|
||||||
|
|
||||||
|
sb.append(" id: ").append(toIndentedString(id)).append("\n");
|
||||||
|
sb.append(" name: ").append(toIndentedString(name)).append("\n");
|
||||||
|
sb.append("}");
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert the given object to string with each line indented by 4 spaces
|
||||||
|
* (except the first line).
|
||||||
|
*/
|
||||||
|
private String toIndentedString(Object o) {
|
||||||
|
if (o == null) {
|
||||||
|
return "null";
|
||||||
|
}
|
||||||
|
return o.toString().replace("\n", "\n ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,168 @@
|
|||||||
|
package io.swagger.model;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonValue;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-02-04T01:58:20.368+07:00")
|
||||||
|
public class Order {
|
||||||
|
|
||||||
|
private Long id = null;
|
||||||
|
private Long petId = null;
|
||||||
|
private Integer quantity = null;
|
||||||
|
private Date shipDate = null;
|
||||||
|
|
||||||
|
|
||||||
|
public enum StatusEnum {
|
||||||
|
PLACED("placed"),
|
||||||
|
APPROVED("approved"),
|
||||||
|
DELIVERED("delivered");
|
||||||
|
|
||||||
|
private String value;
|
||||||
|
|
||||||
|
StatusEnum(String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@JsonValue
|
||||||
|
public String toString() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private StatusEnum status = null;
|
||||||
|
private Boolean complete = null;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
**/
|
||||||
|
|
||||||
|
@JsonProperty("id")
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
**/
|
||||||
|
|
||||||
|
@JsonProperty("petId")
|
||||||
|
public Long getPetId() {
|
||||||
|
return petId;
|
||||||
|
}
|
||||||
|
public void setPetId(Long petId) {
|
||||||
|
this.petId = petId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
**/
|
||||||
|
|
||||||
|
@JsonProperty("quantity")
|
||||||
|
public Integer getQuantity() {
|
||||||
|
return quantity;
|
||||||
|
}
|
||||||
|
public void setQuantity(Integer quantity) {
|
||||||
|
this.quantity = quantity;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
**/
|
||||||
|
|
||||||
|
@JsonProperty("shipDate")
|
||||||
|
public Date getShipDate() {
|
||||||
|
return shipDate;
|
||||||
|
}
|
||||||
|
public void setShipDate(Date shipDate) {
|
||||||
|
this.shipDate = shipDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Order Status
|
||||||
|
**/
|
||||||
|
|
||||||
|
@JsonProperty("status")
|
||||||
|
public StatusEnum getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
public void setStatus(StatusEnum status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
**/
|
||||||
|
|
||||||
|
@JsonProperty("complete")
|
||||||
|
public Boolean getComplete() {
|
||||||
|
return complete;
|
||||||
|
}
|
||||||
|
public void setComplete(Boolean complete) {
|
||||||
|
this.complete = complete;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (o == null || getClass() != o.getClass()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Order order = (Order) o;
|
||||||
|
return Objects.equals(id, order.id) &&
|
||||||
|
Objects.equals(petId, order.petId) &&
|
||||||
|
Objects.equals(quantity, order.quantity) &&
|
||||||
|
Objects.equals(shipDate, order.shipDate) &&
|
||||||
|
Objects.equals(status, order.status) &&
|
||||||
|
Objects.equals(complete, order.complete);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(id, petId, quantity, shipDate, status, complete);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append("class Order {\n");
|
||||||
|
|
||||||
|
sb.append(" id: ").append(toIndentedString(id)).append("\n");
|
||||||
|
sb.append(" petId: ").append(toIndentedString(petId)).append("\n");
|
||||||
|
sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n");
|
||||||
|
sb.append(" shipDate: ").append(toIndentedString(shipDate)).append("\n");
|
||||||
|
sb.append(" status: ").append(toIndentedString(status)).append("\n");
|
||||||
|
sb.append(" complete: ").append(toIndentedString(complete)).append("\n");
|
||||||
|
sb.append("}");
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert the given object to string with each line indented by 4 spaces
|
||||||
|
* (except the first line).
|
||||||
|
*/
|
||||||
|
private String toIndentedString(Object o) {
|
||||||
|
if (o == null) {
|
||||||
|
return "null";
|
||||||
|
}
|
||||||
|
return o.toString().replace("\n", "\n ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,170 @@
|
|||||||
|
package io.swagger.model;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonValue;
|
||||||
|
import io.swagger.model.Category;
|
||||||
|
import io.swagger.model.Tag;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-02-04T01:58:20.368+07:00")
|
||||||
|
public class Pet {
|
||||||
|
|
||||||
|
private Long id = null;
|
||||||
|
private Category category = null;
|
||||||
|
private String name = null;
|
||||||
|
private List<String> photoUrls = new ArrayList<String>();
|
||||||
|
private List<Tag> tags = new ArrayList<Tag>();
|
||||||
|
|
||||||
|
|
||||||
|
public enum StatusEnum {
|
||||||
|
AVAILABLE("available"),
|
||||||
|
PENDING("pending"),
|
||||||
|
SOLD("sold");
|
||||||
|
|
||||||
|
private String value;
|
||||||
|
|
||||||
|
StatusEnum(String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@JsonValue
|
||||||
|
public String toString() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private StatusEnum status = null;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
**/
|
||||||
|
|
||||||
|
@JsonProperty("id")
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
**/
|
||||||
|
|
||||||
|
@JsonProperty("category")
|
||||||
|
public Category getCategory() {
|
||||||
|
return category;
|
||||||
|
}
|
||||||
|
public void setCategory(Category category) {
|
||||||
|
this.category = category;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
**/
|
||||||
|
|
||||||
|
@JsonProperty("name")
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
**/
|
||||||
|
|
||||||
|
@JsonProperty("photoUrls")
|
||||||
|
public List<String> getPhotoUrls() {
|
||||||
|
return photoUrls;
|
||||||
|
}
|
||||||
|
public void setPhotoUrls(List<String> photoUrls) {
|
||||||
|
this.photoUrls = photoUrls;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
**/
|
||||||
|
|
||||||
|
@JsonProperty("tags")
|
||||||
|
public List<Tag> getTags() {
|
||||||
|
return tags;
|
||||||
|
}
|
||||||
|
public void setTags(List<Tag> tags) {
|
||||||
|
this.tags = tags;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* pet status in the store
|
||||||
|
**/
|
||||||
|
|
||||||
|
@JsonProperty("status")
|
||||||
|
public StatusEnum getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
public void setStatus(StatusEnum status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (o == null || getClass() != o.getClass()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Pet pet = (Pet) o;
|
||||||
|
return Objects.equals(id, pet.id) &&
|
||||||
|
Objects.equals(category, pet.category) &&
|
||||||
|
Objects.equals(name, pet.name) &&
|
||||||
|
Objects.equals(photoUrls, pet.photoUrls) &&
|
||||||
|
Objects.equals(tags, pet.tags) &&
|
||||||
|
Objects.equals(status, pet.status);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(id, category, name, photoUrls, tags, status);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append("class Pet {\n");
|
||||||
|
|
||||||
|
sb.append(" id: ").append(toIndentedString(id)).append("\n");
|
||||||
|
sb.append(" category: ").append(toIndentedString(category)).append("\n");
|
||||||
|
sb.append(" name: ").append(toIndentedString(name)).append("\n");
|
||||||
|
sb.append(" photoUrls: ").append(toIndentedString(photoUrls)).append("\n");
|
||||||
|
sb.append(" tags: ").append(toIndentedString(tags)).append("\n");
|
||||||
|
sb.append(" status: ").append(toIndentedString(status)).append("\n");
|
||||||
|
sb.append("}");
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert the given object to string with each line indented by 4 spaces
|
||||||
|
* (except the first line).
|
||||||
|
*/
|
||||||
|
private String toIndentedString(Object o) {
|
||||||
|
if (o == null) {
|
||||||
|
return "null";
|
||||||
|
}
|
||||||
|
return o.toString().replace("\n", "\n ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,86 @@
|
|||||||
|
package io.swagger.model;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonValue;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-02-04T01:58:20.368+07:00")
|
||||||
|
public class Tag {
|
||||||
|
|
||||||
|
private Long id = null;
|
||||||
|
private String name = null;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
**/
|
||||||
|
|
||||||
|
@JsonProperty("id")
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
**/
|
||||||
|
|
||||||
|
@JsonProperty("name")
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (o == null || getClass() != o.getClass()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Tag tag = (Tag) o;
|
||||||
|
return Objects.equals(id, tag.id) &&
|
||||||
|
Objects.equals(name, tag.name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(id, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append("class Tag {\n");
|
||||||
|
|
||||||
|
sb.append(" id: ").append(toIndentedString(id)).append("\n");
|
||||||
|
sb.append(" name: ").append(toIndentedString(name)).append("\n");
|
||||||
|
sb.append("}");
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert the given object to string with each line indented by 4 spaces
|
||||||
|
* (except the first line).
|
||||||
|
*/
|
||||||
|
private String toIndentedString(Object o) {
|
||||||
|
if (o == null) {
|
||||||
|
return "null";
|
||||||
|
}
|
||||||
|
return o.toString().replace("\n", "\n ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,177 @@
|
|||||||
|
package io.swagger.model;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonValue;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-02-04T01:58:20.368+07:00")
|
||||||
|
public class User {
|
||||||
|
|
||||||
|
private Long id = null;
|
||||||
|
private String username = null;
|
||||||
|
private String firstName = null;
|
||||||
|
private String lastName = null;
|
||||||
|
private String email = null;
|
||||||
|
private String password = null;
|
||||||
|
private String phone = null;
|
||||||
|
private Integer userStatus = null;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
**/
|
||||||
|
|
||||||
|
@JsonProperty("id")
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
**/
|
||||||
|
|
||||||
|
@JsonProperty("username")
|
||||||
|
public String getUsername() {
|
||||||
|
return username;
|
||||||
|
}
|
||||||
|
public void setUsername(String username) {
|
||||||
|
this.username = username;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
**/
|
||||||
|
|
||||||
|
@JsonProperty("firstName")
|
||||||
|
public String getFirstName() {
|
||||||
|
return firstName;
|
||||||
|
}
|
||||||
|
public void setFirstName(String firstName) {
|
||||||
|
this.firstName = firstName;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
**/
|
||||||
|
|
||||||
|
@JsonProperty("lastName")
|
||||||
|
public String getLastName() {
|
||||||
|
return lastName;
|
||||||
|
}
|
||||||
|
public void setLastName(String lastName) {
|
||||||
|
this.lastName = lastName;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
**/
|
||||||
|
|
||||||
|
@JsonProperty("email")
|
||||||
|
public String getEmail() {
|
||||||
|
return email;
|
||||||
|
}
|
||||||
|
public void setEmail(String email) {
|
||||||
|
this.email = email;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
**/
|
||||||
|
|
||||||
|
@JsonProperty("password")
|
||||||
|
public String getPassword() {
|
||||||
|
return password;
|
||||||
|
}
|
||||||
|
public void setPassword(String password) {
|
||||||
|
this.password = password;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
**/
|
||||||
|
|
||||||
|
@JsonProperty("phone")
|
||||||
|
public String getPhone() {
|
||||||
|
return phone;
|
||||||
|
}
|
||||||
|
public void setPhone(String phone) {
|
||||||
|
this.phone = phone;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* User Status
|
||||||
|
**/
|
||||||
|
|
||||||
|
@JsonProperty("userStatus")
|
||||||
|
public Integer getUserStatus() {
|
||||||
|
return userStatus;
|
||||||
|
}
|
||||||
|
public void setUserStatus(Integer userStatus) {
|
||||||
|
this.userStatus = userStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (o == null || getClass() != o.getClass()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
User user = (User) o;
|
||||||
|
return Objects.equals(id, user.id) &&
|
||||||
|
Objects.equals(username, user.username) &&
|
||||||
|
Objects.equals(firstName, user.firstName) &&
|
||||||
|
Objects.equals(lastName, user.lastName) &&
|
||||||
|
Objects.equals(email, user.email) &&
|
||||||
|
Objects.equals(password, user.password) &&
|
||||||
|
Objects.equals(phone, user.phone) &&
|
||||||
|
Objects.equals(userStatus, user.userStatus);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append("class User {\n");
|
||||||
|
|
||||||
|
sb.append(" id: ").append(toIndentedString(id)).append("\n");
|
||||||
|
sb.append(" username: ").append(toIndentedString(username)).append("\n");
|
||||||
|
sb.append(" firstName: ").append(toIndentedString(firstName)).append("\n");
|
||||||
|
sb.append(" lastName: ").append(toIndentedString(lastName)).append("\n");
|
||||||
|
sb.append(" email: ").append(toIndentedString(email)).append("\n");
|
||||||
|
sb.append(" password: ").append(toIndentedString(password)).append("\n");
|
||||||
|
sb.append(" phone: ").append(toIndentedString(phone)).append("\n");
|
||||||
|
sb.append(" userStatus: ").append(toIndentedString(userStatus)).append("\n");
|
||||||
|
sb.append("}");
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert the given object to string with each line indented by 4 spaces
|
||||||
|
* (except the first line).
|
||||||
|
*/
|
||||||
|
private String toIndentedString(Object o) {
|
||||||
|
if (o == null) {
|
||||||
|
return "null";
|
||||||
|
}
|
||||||
|
return o.toString().replace("\n", "\n ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,15 @@
|
|||||||
|
package io.swagger.api.factories;
|
||||||
|
|
||||||
|
import io.swagger.api.PetApiService;
|
||||||
|
import io.swagger.api.impl.PetApiServiceImpl;
|
||||||
|
|
||||||
|
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-02-04T01:58:20.368+07:00")
|
||||||
|
public class PetApiServiceFactory {
|
||||||
|
|
||||||
|
private final static PetApiService service = new PetApiServiceImpl();
|
||||||
|
|
||||||
|
public static PetApiService getPetApi()
|
||||||
|
{
|
||||||
|
return service;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
package io.swagger.api.factories;
|
||||||
|
|
||||||
|
import io.swagger.api.PettestingByteArraytrueApiService;
|
||||||
|
import io.swagger.api.impl.PettestingByteArraytrueApiServiceImpl;
|
||||||
|
|
||||||
|
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-02-04T01:58:20.368+07:00")
|
||||||
|
public class PettestingByteArraytrueApiServiceFactory {
|
||||||
|
|
||||||
|
private final static PettestingByteArraytrueApiService service = new PettestingByteArraytrueApiServiceImpl();
|
||||||
|
|
||||||
|
public static PettestingByteArraytrueApiService getPettestingByteArraytrueApi()
|
||||||
|
{
|
||||||
|
return service;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
package io.swagger.api.factories;
|
||||||
|
|
||||||
|
import io.swagger.api.StoreApiService;
|
||||||
|
import io.swagger.api.impl.StoreApiServiceImpl;
|
||||||
|
|
||||||
|
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-02-04T01:58:20.368+07:00")
|
||||||
|
public class StoreApiServiceFactory {
|
||||||
|
|
||||||
|
private final static StoreApiService service = new StoreApiServiceImpl();
|
||||||
|
|
||||||
|
public static StoreApiService getStoreApi()
|
||||||
|
{
|
||||||
|
return service;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
package io.swagger.api.factories;
|
||||||
|
|
||||||
|
import io.swagger.api.UserApiService;
|
||||||
|
import io.swagger.api.impl.UserApiServiceImpl;
|
||||||
|
|
||||||
|
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-02-04T01:58:20.368+07:00")
|
||||||
|
public class UserApiServiceFactory {
|
||||||
|
|
||||||
|
private final static UserApiService service = new UserApiServiceImpl();
|
||||||
|
|
||||||
|
public static UserApiService getUserApi()
|
||||||
|
{
|
||||||
|
return service;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,88 @@
|
|||||||
|
package io.swagger.api.impl;
|
||||||
|
|
||||||
|
import io.swagger.api.*;
|
||||||
|
import io.swagger.model.*;
|
||||||
|
import org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataInput;
|
||||||
|
|
||||||
|
|
||||||
|
import io.swagger.model.Pet;
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import io.swagger.api.NotFoundException;
|
||||||
|
|
||||||
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
import javax.ws.rs.core.Response;
|
||||||
|
import javax.ws.rs.core.SecurityContext;
|
||||||
|
|
||||||
|
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-02-04T01:58:20.368+07:00")
|
||||||
|
|
||||||
|
public class PetApiServiceImpl extends PetApiService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Response updatePet(Pet body,SecurityContext securityContext)
|
||||||
|
throws NotFoundException {
|
||||||
|
// do some magic!
|
||||||
|
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Response addPet(Pet body,SecurityContext securityContext)
|
||||||
|
throws NotFoundException {
|
||||||
|
// do some magic!
|
||||||
|
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Response findPetsByStatus(List<String> status,SecurityContext securityContext)
|
||||||
|
throws NotFoundException {
|
||||||
|
// do some magic!
|
||||||
|
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Response findPetsByTags(List<String> tags,SecurityContext securityContext)
|
||||||
|
throws NotFoundException {
|
||||||
|
// do some magic!
|
||||||
|
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Response getPetById(Long petId,SecurityContext securityContext)
|
||||||
|
throws NotFoundException {
|
||||||
|
// do some magic!
|
||||||
|
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Response updatePetWithForm(String petId,String name,String status,SecurityContext securityContext)
|
||||||
|
throws NotFoundException {
|
||||||
|
// do some magic!
|
||||||
|
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Response deletePet(Long petId,String apiKey,SecurityContext securityContext)
|
||||||
|
throws NotFoundException {
|
||||||
|
// do some magic!
|
||||||
|
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Response uploadFile(MultipartFormDataInput input,Long petId,SecurityContext securityContext)
|
||||||
|
throws NotFoundException {
|
||||||
|
// do some magic!
|
||||||
|
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Response getPetByIdWithByteArray(Long petId,SecurityContext securityContext)
|
||||||
|
throws NotFoundException {
|
||||||
|
// do some magic!
|
||||||
|
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,29 @@
|
|||||||
|
package io.swagger.api.impl;
|
||||||
|
|
||||||
|
import io.swagger.api.*;
|
||||||
|
import io.swagger.model.*;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import io.swagger.api.NotFoundException;
|
||||||
|
|
||||||
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
import javax.ws.rs.core.Response;
|
||||||
|
import javax.ws.rs.core.SecurityContext;
|
||||||
|
|
||||||
|
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-02-04T01:58:20.368+07:00")
|
||||||
|
|
||||||
|
public class PettestingByteArraytrueApiServiceImpl extends PettestingByteArraytrueApiService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Response addPetUsingByteArray(byte[] body,SecurityContext securityContext)
|
||||||
|
throws NotFoundException {
|
||||||
|
// do some magic!
|
||||||
|
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,52 @@
|
|||||||
|
package io.swagger.api.impl;
|
||||||
|
|
||||||
|
import io.swagger.api.*;
|
||||||
|
import io.swagger.model.*;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import io.swagger.model.Order;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import io.swagger.api.NotFoundException;
|
||||||
|
|
||||||
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
import javax.ws.rs.core.Response;
|
||||||
|
import javax.ws.rs.core.SecurityContext;
|
||||||
|
|
||||||
|
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-02-04T01:58:20.368+07:00")
|
||||||
|
|
||||||
|
public class StoreApiServiceImpl extends StoreApiService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Response getInventory(SecurityContext securityContext)
|
||||||
|
throws NotFoundException {
|
||||||
|
// do some magic!
|
||||||
|
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Response placeOrder(Order body,SecurityContext securityContext)
|
||||||
|
throws NotFoundException {
|
||||||
|
// do some magic!
|
||||||
|
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Response getOrderById(String orderId,SecurityContext securityContext)
|
||||||
|
throws NotFoundException {
|
||||||
|
// do some magic!
|
||||||
|
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Response deleteOrder(String orderId,SecurityContext securityContext)
|
||||||
|
throws NotFoundException {
|
||||||
|
// do some magic!
|
||||||
|
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,80 @@
|
|||||||
|
package io.swagger.api.impl;
|
||||||
|
|
||||||
|
import io.swagger.api.*;
|
||||||
|
import io.swagger.model.*;
|
||||||
|
|
||||||
|
|
||||||
|
import io.swagger.model.User;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import io.swagger.api.NotFoundException;
|
||||||
|
|
||||||
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
import javax.ws.rs.core.Response;
|
||||||
|
import javax.ws.rs.core.SecurityContext;
|
||||||
|
|
||||||
|
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-02-04T01:58:20.368+07:00")
|
||||||
|
|
||||||
|
public class UserApiServiceImpl extends UserApiService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Response createUser(User body,SecurityContext securityContext)
|
||||||
|
throws NotFoundException {
|
||||||
|
// do some magic!
|
||||||
|
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Response createUsersWithArrayInput(List<User> body,SecurityContext securityContext)
|
||||||
|
throws NotFoundException {
|
||||||
|
// do some magic!
|
||||||
|
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Response createUsersWithListInput(List<User> body,SecurityContext securityContext)
|
||||||
|
throws NotFoundException {
|
||||||
|
// do some magic!
|
||||||
|
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Response loginUser(String username,String password,SecurityContext securityContext)
|
||||||
|
throws NotFoundException {
|
||||||
|
// do some magic!
|
||||||
|
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Response logoutUser(SecurityContext securityContext)
|
||||||
|
throws NotFoundException {
|
||||||
|
// do some magic!
|
||||||
|
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Response getUserByName(String username,SecurityContext securityContext)
|
||||||
|
throws NotFoundException {
|
||||||
|
// do some magic!
|
||||||
|
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Response updateUser(String username,User body,SecurityContext securityContext)
|
||||||
|
throws NotFoundException {
|
||||||
|
// do some magic!
|
||||||
|
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Response deleteUser(String username,SecurityContext securityContext)
|
||||||
|
throws NotFoundException {
|
||||||
|
// do some magic!
|
||||||
|
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,3 @@
|
|||||||
|
<jboss-web>
|
||||||
|
<context-root>/v2</context-root>
|
||||||
|
</jboss-web>
|
@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||||
|
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
|
||||||
|
xmlns:j2ee="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
|
||||||
|
|
||||||
|
<filter>
|
||||||
|
<filter-name>ApiOriginFilter</filter-name>
|
||||||
|
<filter-class>io.swagger.api.ApiOriginFilter</filter-class>
|
||||||
|
</filter>
|
||||||
|
<filter-mapping>
|
||||||
|
<filter-name>ApiOriginFilter</filter-name>
|
||||||
|
<url-pattern>/*</url-pattern>
|
||||||
|
</filter-mapping>
|
||||||
|
</web-app>
|
Loading…
x
Reference in New Issue
Block a user