forked from loafle/openapi-generator-original
Merge pull request #2488 from swagger-api/feature/jersey2
Add jersey2 server support
This commit is contained in:
commit
aa805a4003
@ -26,6 +26,6 @@ fi
|
|||||||
|
|
||||||
# if you've executed sbt assembly previously it will use that instead.
|
# 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"
|
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 -o samples/server/petstore/jaxrs"
|
ags="$@ generate -t modules/swagger-codegen/src/main/resources/JavaJaxRS -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l jaxrs -o samples/server/petstore/jaxrs"
|
||||||
|
|
||||||
java $JAVA_OPTS -jar $executable $ags
|
java $JAVA_OPTS -jar $executable $ags
|
||||||
|
31
bin/jersey2-petstore-server.sh
Executable file
31
bin/jersey2-petstore-server.sh
Executable 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.yaml -l jaxrs -o samples/server/petstore/jersey2 --library=jersey2"
|
||||||
|
|
||||||
|
java $JAVA_OPTS -jar $executable $ags
|
@ -2,55 +2,22 @@ package io.swagger.codegen;
|
|||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import io.swagger.codegen.examples.ExampleGenerator;
|
import io.swagger.codegen.examples.ExampleGenerator;
|
||||||
import io.swagger.models.ArrayModel;
|
import io.swagger.models.*;
|
||||||
import io.swagger.models.ComposedModel;
|
import io.swagger.models.auth.*;
|
||||||
import io.swagger.models.Model;
|
import io.swagger.models.parameters.*;
|
||||||
import io.swagger.models.ModelImpl;
|
|
||||||
import io.swagger.models.Operation;
|
|
||||||
import io.swagger.models.RefModel;
|
|
||||||
import io.swagger.models.Response;
|
|
||||||
import io.swagger.models.Swagger;
|
|
||||||
import io.swagger.models.auth.ApiKeyAuthDefinition;
|
|
||||||
import io.swagger.models.auth.BasicAuthDefinition;
|
|
||||||
import io.swagger.models.auth.In;
|
|
||||||
import io.swagger.models.auth.OAuth2Definition;
|
|
||||||
import io.swagger.models.auth.SecuritySchemeDefinition;
|
|
||||||
import io.swagger.models.parameters.BodyParameter;
|
|
||||||
import io.swagger.models.parameters.CookieParameter;
|
|
||||||
import io.swagger.models.parameters.FormParameter;
|
|
||||||
import io.swagger.models.parameters.HeaderParameter;
|
|
||||||
import io.swagger.models.parameters.Parameter;
|
|
||||||
import io.swagger.models.parameters.PathParameter;
|
|
||||||
import io.swagger.models.parameters.QueryParameter;
|
|
||||||
import io.swagger.models.parameters.SerializableParameter;
|
|
||||||
import io.swagger.models.properties.*;
|
import io.swagger.models.properties.*;
|
||||||
import io.swagger.models.properties.PropertyBuilder.PropertyId;
|
import io.swagger.models.properties.PropertyBuilder.PropertyId;
|
||||||
import io.swagger.util.Json;
|
import io.swagger.util.Json;
|
||||||
|
import org.apache.commons.lang.StringEscapeUtils;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.LinkedHashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.Set;
|
|
||||||
import java.util.TreeSet;
|
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
@ -203,11 +170,7 @@ public class DefaultCodegen {
|
|||||||
@SuppressWarnings("static-method")
|
@SuppressWarnings("static-method")
|
||||||
public String escapeText(String input) {
|
public String escapeText(String input) {
|
||||||
if (input != null) {
|
if (input != null) {
|
||||||
input = input.trim(); // FIXME: a parameter should not be assigned. Also declare the methods parameters as 'final'.
|
return StringEscapeUtils.escapeJava(input).replace("\\/", "/");
|
||||||
String output = input.replaceAll("\n", "\\\\n");
|
|
||||||
output = output.replace("\r", "\\r");
|
|
||||||
output = output.replace("\"", "\\\"");
|
|
||||||
return output;
|
|
||||||
}
|
}
|
||||||
return input;
|
return input;
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ import io.swagger.models.auth.SecuritySchemeDefinition;
|
|||||||
import io.swagger.models.parameters.Parameter;
|
import io.swagger.models.parameters.Parameter;
|
||||||
import io.swagger.util.Json;
|
import io.swagger.util.Json;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@ -16,7 +17,6 @@ import java.io.*;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import static org.apache.commons.lang3.StringUtils.isNotEmpty;
|
import static org.apache.commons.lang3.StringUtils.isNotEmpty;
|
||||||
import org.apache.commons.lang3.ObjectUtils;
|
|
||||||
|
|
||||||
public class DefaultGenerator extends AbstractGenerator implements Generator {
|
public class DefaultGenerator extends AbstractGenerator implements Generator {
|
||||||
protected Logger LOGGER = LoggerFactory.getLogger(DefaultGenerator.class);
|
protected Logger LOGGER = LoggerFactory.getLogger(DefaultGenerator.class);
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package io.swagger.codegen.languages;
|
package io.swagger.codegen.languages;
|
||||||
|
|
||||||
import io.swagger.codegen.CodegenOperation;
|
import io.swagger.codegen.CodegenOperation;
|
||||||
|
import io.swagger.codegen.CodegenParameter;
|
||||||
import io.swagger.codegen.CodegenResponse;
|
import io.swagger.codegen.CodegenResponse;
|
||||||
import io.swagger.codegen.CodegenType;
|
import io.swagger.codegen.CodegenType;
|
||||||
import io.swagger.models.Operation;
|
import io.swagger.models.Operation;
|
||||||
@ -95,6 +96,25 @@ public abstract class AbstractJavaJAXRSServerCodegen extends JavaClientCodegen
|
|||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
List<CodegenOperation> ops = (List<CodegenOperation>) operations.get("operation");
|
List<CodegenOperation> ops = (List<CodegenOperation>) operations.get("operation");
|
||||||
for ( CodegenOperation operation : ops ) {
|
for ( CodegenOperation operation : ops ) {
|
||||||
|
boolean isMultipartPost = false;
|
||||||
|
List<Map<String, String>> consumes = operation.consumes;
|
||||||
|
if(consumes != null) {
|
||||||
|
for(Map<String, String> consume : consumes) {
|
||||||
|
String mt = consume.get("mediaType");
|
||||||
|
if(mt != null) {
|
||||||
|
if(mt.startsWith("multipart/form-data")) {
|
||||||
|
isMultipartPost = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for(CodegenParameter parameter : operation.allParams) {
|
||||||
|
if(isMultipartPost) {
|
||||||
|
parameter.vendorExtensions.put("x-multipart", "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 ) {
|
||||||
|
@ -6,11 +6,10 @@ import io.swagger.models.Operation;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
public class JavaJerseyServerCodegen extends AbstractJavaJAXRSServerCodegen
|
public class JavaJerseyServerCodegen extends AbstractJavaJAXRSServerCodegen {
|
||||||
{
|
boolean showGenerationTimestamp = false;
|
||||||
|
|
||||||
public JavaJerseyServerCodegen()
|
public JavaJerseyServerCodegen() {
|
||||||
{
|
|
||||||
super();
|
super();
|
||||||
|
|
||||||
sourceFolder = "src/gen/java";
|
sourceFolder = "src/gen/java";
|
||||||
@ -43,11 +42,13 @@ public class JavaJerseyServerCodegen extends AbstractJavaJAXRSServerCodegen
|
|||||||
Map<String, String> supportedLibraries = new LinkedHashMap<String, String>();
|
Map<String, String> supportedLibraries = new LinkedHashMap<String, String>();
|
||||||
|
|
||||||
supportedLibraries.put(DEFAULT_LIBRARY, "Jersey core 1.18.1");
|
supportedLibraries.put(DEFAULT_LIBRARY, "Jersey core 1.18.1");
|
||||||
|
supportedLibraries.put("jersey2", "Jersey core 2.x");
|
||||||
library.setEnum(supportedLibraries);
|
library.setEnum(supportedLibraries);
|
||||||
|
|
||||||
cliOptions.add(library);
|
cliOptions.add(library);
|
||||||
cliOptions.add(new CliOption(CodegenConstants.IMPL_FOLDER, CodegenConstants.IMPL_FOLDER_DESC));
|
cliOptions.add(new CliOption(CodegenConstants.IMPL_FOLDER, CodegenConstants.IMPL_FOLDER_DESC));
|
||||||
cliOptions.add(new CliOption("title", "a title describing the application"));
|
cliOptions.add(new CliOption("title", "a title describing the application"));
|
||||||
|
cliOptions.add(new CliOption("showGenerationTimestamp", "shows the timestamp when files were generated"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -85,6 +86,9 @@ public class JavaJerseyServerCodegen extends AbstractJavaJAXRSServerCodegen
|
|||||||
supportingFiles.add(new SupportingFile("ApiOriginFilter.mustache", (sourceFolder + '/' + apiPackage).replace(".", "/"), "ApiOriginFilter.java"));
|
supportingFiles.add(new SupportingFile("ApiOriginFilter.mustache", (sourceFolder + '/' + apiPackage).replace(".", "/"), "ApiOriginFilter.java"));
|
||||||
supportingFiles.add(new SupportingFile("ApiResponseMessage.mustache", (sourceFolder + '/' + apiPackage).replace(".", "/"), "ApiResponseMessage.java"));
|
supportingFiles.add(new SupportingFile("ApiResponseMessage.mustache", (sourceFolder + '/' + apiPackage).replace(".", "/"), "ApiResponseMessage.java"));
|
||||||
supportingFiles.add(new SupportingFile("NotFoundException.mustache", (sourceFolder + '/' + apiPackage).replace(".", "/"), "NotFoundException.java"));
|
supportingFiles.add(new SupportingFile("NotFoundException.mustache", (sourceFolder + '/' + apiPackage).replace(".", "/"), "NotFoundException.java"));
|
||||||
|
supportingFiles.add(new SupportingFile("jacksonJsonProvider.mustache", (sourceFolder + '/' + apiPackage).replace(".", "/"), "JacksonJsonProvider.java"));
|
||||||
|
writeOptional(outputFolder, new SupportingFile("bootstrap.mustache", (implFolder + '/' + apiPackage).replace(".", "/"), "Bootstrap.java"));
|
||||||
|
|
||||||
writeOptional(outputFolder, new SupportingFile("web.mustache", ("src/main/webapp/WEB-INF"), "web.xml"));
|
writeOptional(outputFolder, new SupportingFile("web.mustache", ("src/main/webapp/WEB-INF"), "web.xml"));
|
||||||
supportingFiles.add(new SupportingFile("StringUtil.mustache", (sourceFolder + '/' + apiPackage).replace(".", "/"), "StringUtil.java"));
|
supportingFiles.add(new SupportingFile("StringUtil.mustache", (sourceFolder + '/' + apiPackage).replace(".", "/"), "StringUtil.java"));
|
||||||
|
|
||||||
@ -92,6 +96,24 @@ public class JavaJerseyServerCodegen extends AbstractJavaJAXRSServerCodegen
|
|||||||
setDateLibrary(additionalProperties.get("dateLibrary").toString());
|
setDateLibrary(additionalProperties.get("dateLibrary").toString());
|
||||||
additionalProperties.put(dateLibrary, "true");
|
additionalProperties.put(dateLibrary, "true");
|
||||||
}
|
}
|
||||||
|
if(DEFAULT_LIBRARY.equals(library) || library == null) {
|
||||||
|
if(templateDir.startsWith(JAXRS_TEMPLATE_DIRECTORY_NAME)) {
|
||||||
|
// set to the default location
|
||||||
|
templateDir = JAXRS_TEMPLATE_DIRECTORY_NAME + File.separator + "jersey1_18";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
templateDir += File.separator + "jersey1_18";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if("jersey2".equals(library)) {
|
||||||
|
if(templateDir.startsWith(JAXRS_TEMPLATE_DIRECTORY_NAME)) {
|
||||||
|
// set to the default location
|
||||||
|
templateDir = JAXRS_TEMPLATE_DIRECTORY_NAME + File.separator + "jersey2";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
templateDir += File.separator + "jersey2";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( "joda".equals(dateLibrary) ) {
|
if ( "joda".equals(dateLibrary) ) {
|
||||||
supportingFiles.add(new SupportingFile("JodaDateTimeProvider.mustache", (sourceFolder + '/' + apiPackage).replace(".", "/"), "JodaDateTimeProvider.java"));
|
supportingFiles.add(new SupportingFile("JodaDateTimeProvider.mustache", (sourceFolder + '/' + apiPackage).replace(".", "/"), "JodaDateTimeProvider.java"));
|
||||||
@ -129,4 +151,8 @@ public class JavaJerseyServerCodegen extends AbstractJavaJAXRSServerCodegen
|
|||||||
opList.add(co);
|
opList.add(co);
|
||||||
co.baseName = basePath;
|
co.baseName = basePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void showGenerationTimestamp(boolean showGenerationTimestamp) {
|
||||||
|
this.showGenerationTimestamp = showGenerationTimestamp;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -110,7 +110,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.swagger</groupId>
|
<groupId>io.swagger</groupId>
|
||||||
<artifactId>swagger-annotations</artifactId>
|
<artifactId>swagger-annotations</artifactId>
|
||||||
<version>${swagger-annotations-version}</version>
|
<version>${swagger-core-version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- HTTP client: Netflix Feign -->
|
<!-- HTTP client: Netflix Feign -->
|
||||||
@ -179,7 +179,7 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<properties>
|
<properties>
|
||||||
<swagger-annotations-version>1.5.0</swagger-annotations-version>
|
<swagger-core-version>1.5.8</swagger-core-version>
|
||||||
<feign-version>8.1.1</feign-version>
|
<feign-version>8.1.1</feign-version>
|
||||||
<jackson-version>2.6.3</jackson-version>
|
<jackson-version>2.6.3</jackson-version>
|
||||||
<jodatime-version>2.5</jodatime-version>
|
<jodatime-version>2.5</jodatime-version>
|
||||||
|
@ -131,7 +131,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.swagger</groupId>
|
<groupId>io.swagger</groupId>
|
||||||
<artifactId>swagger-annotations</artifactId>
|
<artifactId>swagger-annotations</artifactId>
|
||||||
<version>${swagger-annotations-version}</version>
|
<version>${swagger-core-version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- HTTP client: jersey-client -->
|
<!-- HTTP client: jersey-client -->
|
||||||
@ -194,7 +194,7 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<properties>
|
<properties>
|
||||||
<swagger-annotations-version>1.5.0</swagger-annotations-version>
|
<swagger-core-version>1.5.8</swagger-core-version>
|
||||||
<jersey-version>2.22</jersey-version>
|
<jersey-version>2.22</jersey-version>
|
||||||
<jackson-version>2.4.2</jackson-version>
|
<jackson-version>2.4.2</jackson-version>
|
||||||
<jodatime-version>2.3</jodatime-version>
|
<jodatime-version>2.3</jodatime-version>
|
||||||
|
@ -132,7 +132,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.swagger</groupId>
|
<groupId>io.swagger</groupId>
|
||||||
<artifactId>swagger-annotations</artifactId>
|
<artifactId>swagger-annotations</artifactId>
|
||||||
<version>${swagger-annotations-version}</version>
|
<version>${swagger-core-version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.squareup.okhttp</groupId>
|
<groupId>com.squareup.okhttp</groupId>
|
||||||
@ -159,7 +159,7 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<properties>
|
<properties>
|
||||||
<swagger-annotations-version>1.5.0</swagger-annotations-version>
|
<swagger-core-version>1.5.8</swagger-core-version>
|
||||||
<okhttp-version>2.7.2</okhttp-version>
|
<okhttp-version>2.7.2</okhttp-version>
|
||||||
<gson-version>2.3.1</gson-version>
|
<gson-version>2.3.1</gson-version>
|
||||||
<maven-plugin-version>1.0.0</maven-plugin-version>
|
<maven-plugin-version>1.0.0</maven-plugin-version>
|
||||||
|
@ -110,7 +110,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.swagger</groupId>
|
<groupId>io.swagger</groupId>
|
||||||
<artifactId>swagger-annotations</artifactId>
|
<artifactId>swagger-annotations</artifactId>
|
||||||
<version>${swagger-annotations-version}</version>
|
<version>${swagger-core-version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.squareup.retrofit</groupId>
|
<groupId>com.squareup.retrofit</groupId>
|
||||||
@ -137,7 +137,7 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<properties>
|
<properties>
|
||||||
<swagger-annotations-version>1.5.0</swagger-annotations-version>
|
<swagger-core-version>1.5.8</swagger-core-version>
|
||||||
<retrofit-version>1.9.0</retrofit-version>
|
<retrofit-version>1.9.0</retrofit-version>
|
||||||
<okhttp-version>2.4.0</okhttp-version>
|
<okhttp-version>2.4.0</okhttp-version>
|
||||||
<oltu-version>1.0.0</oltu-version>
|
<oltu-version>1.0.0</oltu-version>
|
||||||
|
@ -111,7 +111,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.swagger</groupId>
|
<groupId>io.swagger</groupId>
|
||||||
<artifactId>swagger-annotations</artifactId>
|
<artifactId>swagger-annotations</artifactId>
|
||||||
<version>${swagger-annotations-version}</version>
|
<version>${swagger-core-version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.squareup.retrofit2</groupId>
|
<groupId>com.squareup.retrofit2</groupId>
|
||||||
@ -153,7 +153,7 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<properties>
|
<properties>
|
||||||
<swagger-annotations-version>1.5.0</swagger-annotations-version>
|
<swagger-core-version>1.5.8</swagger-core-version>
|
||||||
<retrofit-version>2.0.0-beta4</retrofit-version>{{#useRxJava}}
|
<retrofit-version>2.0.0-beta4</retrofit-version>{{#useRxJava}}
|
||||||
<rxjava-version>1.0.16</rxjava-version>{{/useRxJava}}
|
<rxjava-version>1.0.16</rxjava-version>{{/useRxJava}}
|
||||||
<oltu-version>1.0.0</oltu-version>
|
<oltu-version>1.0.0</oltu-version>
|
||||||
|
@ -46,10 +46,10 @@ public class {{classname}} {
|
|||||||
{{/hasMore}}{{/authMethods}}
|
{{/hasMore}}{{/authMethods}}
|
||||||
}{{/hasAuthMethods}}, tags={ {{#vendorExtensions.x-tags}}"{{tag}}"{{#hasMore}}, {{/hasMore}}{{/vendorExtensions.x-tags}} })
|
}{{/hasAuthMethods}}, tags={ {{#vendorExtensions.x-tags}}"{{tag}}"{{#hasMore}}, {{/hasMore}}{{/vendorExtensions.x-tags}} })
|
||||||
@io.swagger.annotations.ApiResponses(value = { {{#responses}}
|
@io.swagger.annotations.ApiResponses(value = { {{#responses}}
|
||||||
@io.swagger.annotations.ApiResponse(code = {{{code}}}, message = "{{{message}}}", response = {{{returnType}}}.class{{#returnContainer}}, responseContainer = "{{{returnContainer}}}"{{/returnContainer}}){{#hasMore}},
|
@io.swagger.annotations.ApiResponse(code = {{{code}}}, message = "{{{message}}}", response = {{{returnType}}}.class{{#returnContainer}}, responseContainer = "{{{returnContainer}}}"{{/returnContainer}}){{#hasMore}},{{/hasMore}}{{/responses}} })
|
||||||
{{/hasMore}}{{/responses}} })
|
public Response {{nickname}}(
|
||||||
|
{{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}},
|
||||||
public Response {{nickname}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}},{{/allParams}}@Context SecurityContext securityContext)
|
{{/allParams}}@Context SecurityContext securityContext)
|
||||||
throws NotFoundException {
|
throws NotFoundException {
|
||||||
return delegate.{{nickname}}({{#allParams}}{{#isFile}}inputStream, fileDetail{{/isFile}}{{^isFile}}{{paramName}}{{/isFile}},{{/allParams}}securityContext);
|
return delegate.{{nickname}}({{#allParams}}{{#isFile}}inputStream, fileDetail{{/isFile}}{{^isFile}}{{paramName}}{{/isFile}},{{/allParams}}securityContext);
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,31 @@
|
|||||||
|
package {{apiPackage}};
|
||||||
|
|
||||||
|
import io.swagger.jaxrs.config.SwaggerContextService;
|
||||||
|
import io.swagger.models.*;
|
||||||
|
|
||||||
|
import io.swagger.models.auth.*;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServlet;
|
||||||
|
import javax.servlet.ServletContext;
|
||||||
|
import javax.servlet.ServletConfig;
|
||||||
|
import javax.servlet.ServletException;
|
||||||
|
|
||||||
|
public class Bootstrap extends HttpServlet {
|
||||||
|
@Override
|
||||||
|
public void init(ServletConfig config) throws ServletException {
|
||||||
|
Info info = new Info()
|
||||||
|
.title("{{title}}")
|
||||||
|
.description("{{{appDescription}}}")
|
||||||
|
.termsOfService("{{termsOfService}}")
|
||||||
|
.contact(new Contact()
|
||||||
|
.email("{{infoEmail}}"))
|
||||||
|
.license(new License()
|
||||||
|
.name("{{licenseInfo}}")
|
||||||
|
.url("{{licenseUrl}}"));
|
||||||
|
|
||||||
|
ServletContext context = config.getServletContext();
|
||||||
|
Swagger swagger = new Swagger().info(info);
|
||||||
|
|
||||||
|
new SwaggerContextService().withServletConfig(config).updateSwagger(swagger);
|
||||||
|
}
|
||||||
|
}
|
@ -1,2 +1,2 @@
|
|||||||
{{#isFormParam}}{{#notFile}}@ApiParam(value = "{{{description}}}"{{#required}}, required=true{{/required}}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}})@FormParam("{{paramName}}") {{{dataType}}} {{paramName}}{{/notFile}}{{#isFile}} @FormDataParam("file") InputStream inputStream,
|
{{#isFormParam}}{{#notFile}}{{^vendorExtensions.x-multipart}}@ApiParam(value = "{{{description}}}"{{#required}}, required=true{{/required}}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}){{/vendorExtensions.x-multipart}}{{#vendorExtensions.x-multipart}}@FormDataParam("{{paramName}}") {{{dataType}}} {{paramName}}{{/vendorExtensions.x-multipart}}{{^vendorExtensions.x-multipart}}@FormParam("{{paramName}}") {{{dataType}}} {{paramName}}{{/vendorExtensions.x-multipart}}{{/notFile}}{{#isFile}}@FormDataParam("file") InputStream inputStream,
|
||||||
@FormDataParam("file") FormDataContentDisposition fileDetail{{/isFile}}{{/isFormParam}}
|
@FormDataParam("file") FormDataContentDisposition fileDetail{{/isFile}}{{/isFormParam}}
|
@ -1 +1 @@
|
|||||||
@javax.annotation.Generated(value = "{{generatorClass}}", date = "{{generatedDate}}")
|
{{#showGenerationTimestamps}}@javax.annotation.Generated(value = "{{generatorClass}}", date = "{{generatedDate}}"){{/showGenerationTimestamps}}
|
@ -0,0 +1,19 @@
|
|||||||
|
package {{apiPackage}};
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider;
|
||||||
|
import io.swagger.util.Json;
|
||||||
|
|
||||||
|
import javax.ws.rs.Produces;
|
||||||
|
import javax.ws.rs.core.MediaType;
|
||||||
|
import javax.ws.rs.ext.Provider;
|
||||||
|
|
||||||
|
@Provider
|
||||||
|
@Produces({MediaType.APPLICATION_JSON})
|
||||||
|
public class JacksonJsonProvider extends JacksonJaxbJsonProvider {
|
||||||
|
private static ObjectMapper commonMapper = Json.mapper();
|
||||||
|
|
||||||
|
public JacksonJsonProvider() {
|
||||||
|
super.setMapper(commonMapper);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,10 @@
|
|||||||
|
package {{apiPackage}};
|
||||||
|
|
||||||
|
{{>generatedAnnotation}}
|
||||||
|
public class ApiException extends Exception{
|
||||||
|
private int code;
|
||||||
|
public ApiException (int code, String msg) {
|
||||||
|
super(msg);
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
package {{apiPackage}};
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import javax.servlet.*;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
{{>generatedAnnotation}}
|
||||||
|
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 {{apiPackage}};
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlTransient;
|
||||||
|
|
||||||
|
@javax.xml.bind.annotation.XmlRootElement
|
||||||
|
{{>generatedAnnotation}}
|
||||||
|
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,44 @@
|
|||||||
|
package {{apiPackage}};
|
||||||
|
|
||||||
|
import com.sun.jersey.core.spi.component.ComponentContext;
|
||||||
|
import com.sun.jersey.spi.inject.Injectable;
|
||||||
|
import com.sun.jersey.spi.inject.PerRequestTypeInjectableProvider;
|
||||||
|
|
||||||
|
import javax.ws.rs.QueryParam;
|
||||||
|
import javax.ws.rs.WebApplicationException;
|
||||||
|
import javax.ws.rs.core.Context;
|
||||||
|
import javax.ws.rs.core.Response;
|
||||||
|
import javax.ws.rs.core.Response.Status;
|
||||||
|
import javax.ws.rs.core.UriInfo;
|
||||||
|
import javax.ws.rs.ext.Provider;
|
||||||
|
import org.joda.time.DateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Provider
|
||||||
|
public class JodaDateTimeProvider extends PerRequestTypeInjectableProvider<QueryParam, DateTime> {
|
||||||
|
private final UriInfo uriInfo;
|
||||||
|
|
||||||
|
public JodaDateTimeProvider(@Context UriInfo uriInfo) {
|
||||||
|
super(DateTime.class);
|
||||||
|
this.uriInfo = uriInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Injectable<DateTime> getInjectable(final ComponentContext cc, final QueryParam a) {
|
||||||
|
return new Injectable<DateTime>() {
|
||||||
|
@Override
|
||||||
|
public DateTime getValue() {
|
||||||
|
final List<String> values = uriInfo.getQueryParameters().get(a.value());
|
||||||
|
|
||||||
|
if (values == null || values.isEmpty())
|
||||||
|
return null;
|
||||||
|
if (values.size() > 1) {
|
||||||
|
throw new WebApplicationException(Response.status(Status.BAD_REQUEST).
|
||||||
|
entity(a.value() + " cannot contain multiple values").build());
|
||||||
|
}
|
||||||
|
|
||||||
|
return DateTime.parse(values.get(0));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,44 @@
|
|||||||
|
package {{apiPackage}};
|
||||||
|
|
||||||
|
import com.sun.jersey.core.spi.component.ComponentContext;
|
||||||
|
import com.sun.jersey.spi.inject.Injectable;
|
||||||
|
import com.sun.jersey.spi.inject.PerRequestTypeInjectableProvider;
|
||||||
|
|
||||||
|
import javax.ws.rs.QueryParam;
|
||||||
|
import javax.ws.rs.WebApplicationException;
|
||||||
|
import javax.ws.rs.core.Context;
|
||||||
|
import javax.ws.rs.core.Response;
|
||||||
|
import javax.ws.rs.core.Response.Status;
|
||||||
|
import javax.ws.rs.core.UriInfo;
|
||||||
|
import javax.ws.rs.ext.Provider;
|
||||||
|
import org.joda.time.LocalDate;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Provider
|
||||||
|
public class JodaLocalDateProvider extends PerRequestTypeInjectableProvider<QueryParam, LocalDate> {
|
||||||
|
private final UriInfo uriInfo;
|
||||||
|
|
||||||
|
public JodaLocalDateProvider(@Context UriInfo uriInfo) {
|
||||||
|
super(LocalDate.class);
|
||||||
|
this.uriInfo = uriInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Injectable<LocalDate> getInjectable(final ComponentContext cc, final QueryParam a) {
|
||||||
|
return new Injectable<LocalDate>() {
|
||||||
|
@Override
|
||||||
|
public LocalDate getValue() {
|
||||||
|
final List<String> values = uriInfo.getQueryParameters().get(a.value());
|
||||||
|
|
||||||
|
if (values == null || values.isEmpty())
|
||||||
|
return null;
|
||||||
|
if (values.size() > 1) {
|
||||||
|
throw new WebApplicationException(Response.status(Status.BAD_REQUEST).
|
||||||
|
entity(a.value() + " cannot contain multiple values").build());
|
||||||
|
}
|
||||||
|
|
||||||
|
return LocalDate.parse(values.get(0));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,44 @@
|
|||||||
|
package {{apiPackage}};
|
||||||
|
|
||||||
|
import com.sun.jersey.core.spi.component.ComponentContext;
|
||||||
|
import com.sun.jersey.spi.inject.Injectable;
|
||||||
|
import com.sun.jersey.spi.inject.PerRequestTypeInjectableProvider;
|
||||||
|
|
||||||
|
import javax.ws.rs.QueryParam;
|
||||||
|
import javax.ws.rs.WebApplicationException;
|
||||||
|
import javax.ws.rs.core.Context;
|
||||||
|
import javax.ws.rs.core.Response;
|
||||||
|
import javax.ws.rs.core.Response.Status;
|
||||||
|
import javax.ws.rs.core.UriInfo;
|
||||||
|
import javax.ws.rs.ext.Provider;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Provider
|
||||||
|
public class LocalDateProvider extends PerRequestTypeInjectableProvider<QueryParam, LocalDate> {
|
||||||
|
private final UriInfo uriInfo;
|
||||||
|
|
||||||
|
public LocalDateProvider(@Context UriInfo uriInfo) {
|
||||||
|
super(LocalDate.class);
|
||||||
|
this.uriInfo = uriInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Injectable<LocalDate> getInjectable(final ComponentContext cc, final QueryParam a) {
|
||||||
|
return new Injectable<LocalDate>() {
|
||||||
|
@Override
|
||||||
|
public LocalDate getValue() {
|
||||||
|
final List<String> values = uriInfo.getQueryParameters().get(a.value());
|
||||||
|
|
||||||
|
if (values == null || values.isEmpty())
|
||||||
|
return null;
|
||||||
|
if (values.size() > 1) {
|
||||||
|
throw new WebApplicationException(Response.status(Status.BAD_REQUEST).
|
||||||
|
entity(a.value() + " cannot contain multiple values").build());
|
||||||
|
}
|
||||||
|
|
||||||
|
return LocalDate.parse(values.get(0));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,44 @@
|
|||||||
|
package {{apiPackage}};
|
||||||
|
|
||||||
|
import com.sun.jersey.core.spi.component.ComponentContext;
|
||||||
|
import com.sun.jersey.spi.inject.Injectable;
|
||||||
|
import com.sun.jersey.spi.inject.PerRequestTypeInjectableProvider;
|
||||||
|
|
||||||
|
import javax.ws.rs.QueryParam;
|
||||||
|
import javax.ws.rs.WebApplicationException;
|
||||||
|
import javax.ws.rs.core.Context;
|
||||||
|
import javax.ws.rs.core.Response;
|
||||||
|
import javax.ws.rs.core.Response.Status;
|
||||||
|
import javax.ws.rs.core.UriInfo;
|
||||||
|
import javax.ws.rs.ext.Provider;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Provider
|
||||||
|
public class LocalDateTimeProvider extends PerRequestTypeInjectableProvider<QueryParam, LocalDateTime> {
|
||||||
|
private final UriInfo uriInfo;
|
||||||
|
|
||||||
|
public LocalDateTimeProvider(@Context UriInfo uriInfo) {
|
||||||
|
super(LocalDateTime.class);
|
||||||
|
this.uriInfo = uriInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Injectable<LocalDateTime> getInjectable(final ComponentContext cc, final QueryParam a) {
|
||||||
|
return new Injectable<LocalDateTime>() {
|
||||||
|
@Override
|
||||||
|
public LocalDateTime getValue() {
|
||||||
|
final List<String> values = uriInfo.getQueryParameters().get(a.value());
|
||||||
|
|
||||||
|
if (values == null || values.isEmpty())
|
||||||
|
return null;
|
||||||
|
if (values.size() > 1) {
|
||||||
|
throw new WebApplicationException(Response.status(Status.BAD_REQUEST).
|
||||||
|
entity(a.value() + " cannot contain multiple values").build());
|
||||||
|
}
|
||||||
|
|
||||||
|
return LocalDateTime.parse(values.get(0));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,10 @@
|
|||||||
|
package {{apiPackage}};
|
||||||
|
|
||||||
|
{{>generatedAnnotation}}
|
||||||
|
public class NotFoundException extends ApiException {
|
||||||
|
private int code;
|
||||||
|
public NotFoundException (int code, String msg) {
|
||||||
|
super(code, msg);
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
# Swagger Jersey 2 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:{{serverPort}}{{contextPath}}/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!
|
@ -0,0 +1,42 @@
|
|||||||
|
package {{invokerPackage}};
|
||||||
|
|
||||||
|
{{>generatedAnnotation}}
|
||||||
|
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 @@
|
|||||||
|
{{#allowableValues}}allowableValues="{{#values}}{{{.}}}{{^-last}}, {{/-last}}{{/values}}{{^values}}range=[{{#min}}{{.}}{{/min}}{{^min}}-infinity{{/min}}, {{#max}}{{.}}{{/max}}{{^max}}infinity{{/max}}]{{/values}}"{{/allowableValues}}
|
@ -0,0 +1,55 @@
|
|||||||
|
package {{package}};
|
||||||
|
|
||||||
|
import {{modelPackage}}.*;
|
||||||
|
import {{package}}.{{classname}}Service;
|
||||||
|
import {{package}}.factories.{{classname}}ServiceFactory;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiParam;
|
||||||
|
|
||||||
|
{{#imports}}import {{import}};
|
||||||
|
{{/imports}}
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import {{package}}.NotFoundException;
|
||||||
|
|
||||||
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
|
||||||
|
import org.glassfish.jersey.media.multipart.FormDataParam;
|
||||||
|
|
||||||
|
import javax.ws.rs.core.Context;
|
||||||
|
import javax.ws.rs.core.Response;
|
||||||
|
import javax.ws.rs.core.SecurityContext;
|
||||||
|
import javax.ws.rs.*;
|
||||||
|
|
||||||
|
@Path("/{{baseName}}")
|
||||||
|
{{#hasConsumes}}@Consumes({ {{#consumes}}"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} }){{/hasConsumes}}
|
||||||
|
{{#hasProduces}}@Produces({ {{#produces}}"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }){{/hasProduces}}
|
||||||
|
@io.swagger.annotations.Api(description = "the {{baseName}} API")
|
||||||
|
{{>generatedAnnotation}}
|
||||||
|
{{#operations}}
|
||||||
|
public class {{classname}} {
|
||||||
|
private final {{classname}}Service delegate = {{classname}}ServiceFactory.get{{classname}}();
|
||||||
|
|
||||||
|
{{#operation}}
|
||||||
|
@{{httpMethod}}
|
||||||
|
{{#subresourceOperation}}@Path("{{path}}"){{/subresourceOperation}}
|
||||||
|
{{#hasConsumes}}@Consumes({ {{#consumes}}"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} }){{/hasConsumes}}
|
||||||
|
{{#hasProduces}}@Produces({ {{#produces}}"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }){{/hasProduces}}
|
||||||
|
@io.swagger.annotations.ApiOperation(value = "{{{summary}}}", notes = "{{{notes}}}", response = {{{returnType}}}.class{{#returnContainer}}, responseContainer = "{{{returnContainer}}}"{{/returnContainer}}{{#hasAuthMethods}}, authorizations = {
|
||||||
|
{{#authMethods}}@io.swagger.annotations.Authorization(value = "{{name}}"{{#isOAuth}}, scopes = {
|
||||||
|
{{#scopes}}@io.swagger.annotations.AuthorizationScope(scope = "{{scope}}", description = "{{description}}"){{#hasMore}},
|
||||||
|
{{/hasMore}}{{/scopes}}
|
||||||
|
}{{/isOAuth}}){{#hasMore}},
|
||||||
|
{{/hasMore}}{{/authMethods}}
|
||||||
|
}{{/hasAuthMethods}}, tags={ {{#vendorExtensions.x-tags}}"{{tag}}",{{/vendorExtensions.x-tags}} })
|
||||||
|
@io.swagger.annotations.ApiResponses(value = { {{#responses}}
|
||||||
|
@io.swagger.annotations.ApiResponse(code = {{{code}}}, message = "{{{message}}}", response = {{{returnType}}}.class{{#returnContainer}}, responseContainer = "{{{returnContainer}}}"{{/returnContainer}}){{#hasMore}},
|
||||||
|
{{/hasMore}}{{/responses}} })
|
||||||
|
public Response {{nickname}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}},{{/allParams}}@Context SecurityContext securityContext)
|
||||||
|
throws NotFoundException {
|
||||||
|
return delegate.{{nickname}}({{#allParams}}{{#isFile}}inputStream, fileDetail{{/isFile}}{{^isFile}}{{paramName}}{{/isFile}},{{/allParams}}securityContext);
|
||||||
|
}
|
||||||
|
{{/operation}}
|
||||||
|
}
|
||||||
|
{{/operations}}
|
@ -0,0 +1,26 @@
|
|||||||
|
package {{package}};
|
||||||
|
|
||||||
|
import {{package}}.*;
|
||||||
|
import {{modelPackage}}.*;
|
||||||
|
|
||||||
|
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
|
||||||
|
|
||||||
|
{{#imports}}import {{import}};
|
||||||
|
{{/imports}}
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import {{package}}.NotFoundException;
|
||||||
|
|
||||||
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
import javax.ws.rs.core.Response;
|
||||||
|
import javax.ws.rs.core.SecurityContext;
|
||||||
|
|
||||||
|
{{>generatedAnnotation}}
|
||||||
|
{{#operations}}
|
||||||
|
public abstract class {{classname}}Service {
|
||||||
|
{{#operation}}
|
||||||
|
public abstract Response {{nickname}}({{#allParams}}{{>serviceQueryParams}}{{>servicePathParams}}{{>serviceHeaderParams}}{{>serviceBodyParams}}{{>serviceFormParams}},{{/allParams}}SecurityContext securityContext) throws NotFoundException;
|
||||||
|
{{/operation}}
|
||||||
|
}
|
||||||
|
{{/operations}}
|
@ -0,0 +1,13 @@
|
|||||||
|
package {{package}}.factories;
|
||||||
|
|
||||||
|
import {{package}}.{{classname}}Service;
|
||||||
|
import {{package}}.impl.{{classname}}ServiceImpl;
|
||||||
|
|
||||||
|
{{>generatedAnnotation}}
|
||||||
|
public class {{classname}}ServiceFactory {
|
||||||
|
private final static {{classname}}Service service = new {{classname}}ServiceImpl();
|
||||||
|
|
||||||
|
public static {{classname}}Service get{{classname}}() {
|
||||||
|
return service;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
package {{package}}.impl;
|
||||||
|
|
||||||
|
import {{package}}.*;
|
||||||
|
import {{modelPackage}}.*;
|
||||||
|
|
||||||
|
{{#imports}}import {{import}};
|
||||||
|
{{/imports}}
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import {{package}}.NotFoundException;
|
||||||
|
|
||||||
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
|
||||||
|
|
||||||
|
import javax.ws.rs.core.Response;
|
||||||
|
import javax.ws.rs.core.SecurityContext;
|
||||||
|
|
||||||
|
{{>generatedAnnotation}}
|
||||||
|
{{#operations}}
|
||||||
|
public class {{classname}}ServiceImpl extends {{classname}}Service {
|
||||||
|
{{#operation}}
|
||||||
|
@Override
|
||||||
|
public Response {{nickname}}({{#allParams}}{{>serviceQueryParams}}{{>servicePathParams}}{{>serviceHeaderParams}}{{>serviceBodyParams}}{{>serviceFormParams}}, {{/allParams}}SecurityContext securityContext) throws NotFoundException {
|
||||||
|
// do some magic!
|
||||||
|
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||||
|
}
|
||||||
|
{{/operation}}
|
||||||
|
}
|
||||||
|
{{/operations}}
|
@ -0,0 +1 @@
|
|||||||
|
{{#isBodyParam}}@ApiParam(value = "{{{description}}}" {{#required}},required=true{{/required}}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}) {{{dataType}}} {{paramName}}{{/isBodyParam}}
|
@ -0,0 +1,31 @@
|
|||||||
|
package {{apiPackage}};
|
||||||
|
|
||||||
|
import io.swagger.jaxrs.config.SwaggerContextService;
|
||||||
|
import io.swagger.models.*;
|
||||||
|
|
||||||
|
import io.swagger.models.auth.*;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServlet;
|
||||||
|
import javax.servlet.ServletContext;
|
||||||
|
import javax.servlet.ServletConfig;
|
||||||
|
import javax.servlet.ServletException;
|
||||||
|
|
||||||
|
public class Bootstrap extends HttpServlet {
|
||||||
|
@Override
|
||||||
|
public void init(ServletConfig config) throws ServletException {
|
||||||
|
Info info = new Info()
|
||||||
|
.title("{{title}}")
|
||||||
|
.description("{{{appDescription}}}")
|
||||||
|
.termsOfService("{{termsOfService}}")
|
||||||
|
.contact(new Contact()
|
||||||
|
.email("{{infoEmail}}"))
|
||||||
|
.license(new License()
|
||||||
|
.name("{{licenseInfo}}")
|
||||||
|
.url("{{licenseUrl}}"));
|
||||||
|
|
||||||
|
ServletContext context = config.getServletContext();
|
||||||
|
Swagger swagger = new Swagger().info(info);
|
||||||
|
|
||||||
|
new SwaggerContextService().withServletConfig(config).updateSwagger(swagger);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
|
||||||
|
public enum {{{datatypeWithEnum}}} {
|
||||||
|
{{#allowableValues}}{{#enumVars}}{{{name}}}("{{{value}}}"){{^-last}},
|
||||||
|
{{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}}
|
||||||
|
|
||||||
|
private String value;
|
||||||
|
|
||||||
|
{{{datatypeWithEnum}}}(String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@JsonValue
|
||||||
|
public String toString() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,3 @@
|
|||||||
|
public enum {{classname}} {
|
||||||
|
{{#allowableValues}}{{.}}{{^-last}}, {{/-last}}{{/allowableValues}}
|
||||||
|
}
|
@ -0,0 +1,3 @@
|
|||||||
|
{{#isFormParam}}{{#notFile}}@ApiParam(value = "{{{description}}}"{{#required}}, required=true{{/required}}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}){{#vendorExtensions.x-multipart}}@FormDataParam("{{paramName}}") {{{dataType}}} {{paramName}}{{/vendorExtensions.x-multipart}}{{^vendorExtensions.x-multipart}}@FormParam("{{paramName}}") {{{dataType}}} {{paramName}}{{/vendorExtensions.x-multipart}}{{/notFile}}{{#isFile}}
|
||||||
|
@FormDataParam("file") InputStream inputStream,
|
||||||
|
@FormDataParam("file") FormDataContentDisposition fileDetail{{/isFile}}{{/isFormParam}}
|
@ -0,0 +1 @@
|
|||||||
|
{{#showGenerationTimestamps}}@javax.annotation.Generated(value = "{{generatorClass}}", date = "{{generatedDate}}"){{/showGenerationTimestamps}}
|
@ -0,0 +1 @@
|
|||||||
|
{{#isHeaderParam}}@ApiParam(value = "{{{description}}}" {{#required}},required=true{{/required}}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}})@HeaderParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/isHeaderParam}}
|
@ -0,0 +1,19 @@
|
|||||||
|
package {{apiPackage}};
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider;
|
||||||
|
import io.swagger.util.Json;
|
||||||
|
|
||||||
|
import javax.ws.rs.Produces;
|
||||||
|
import javax.ws.rs.core.MediaType;
|
||||||
|
import javax.ws.rs.ext.Provider;
|
||||||
|
|
||||||
|
@Provider
|
||||||
|
@Produces({MediaType.APPLICATION_JSON})
|
||||||
|
public class JacksonJsonProvider extends JacksonJaxbJsonProvider {
|
||||||
|
private static ObjectMapper commonMapper = Json.mapper();
|
||||||
|
|
||||||
|
public JacksonJsonProvider() {
|
||||||
|
super.setMapper(commonMapper);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
package {{package}};
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
{{#imports}}import {{import}};
|
||||||
|
{{/imports}}
|
||||||
|
|
||||||
|
{{#serializableModel}}import java.io.Serializable;{{/serializableModel}}
|
||||||
|
{{#models}}
|
||||||
|
{{#model}}{{#description}}
|
||||||
|
/**
|
||||||
|
* {{description}}
|
||||||
|
**/{{/description}}
|
||||||
|
{{#isEnum}}{{>enumOuterClass}}{{/isEnum}}
|
||||||
|
{{^isEnum}}{{>pojo}}{{/isEnum}}
|
||||||
|
{{/model}}
|
||||||
|
{{/models}}
|
@ -0,0 +1 @@
|
|||||||
|
{{#isPathParam}}@ApiParam(value = "{{{description}}}"{{#required}},required=true{{/required}}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}) @PathParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/isPathParam}}
|
@ -0,0 +1,73 @@
|
|||||||
|
{{#description}}@ApiModel(description = "{{{description}}}"){{/description}}
|
||||||
|
{{>generatedAnnotation}}
|
||||||
|
public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#serializableModel}}implements Serializable{{/serializableModel}} {
|
||||||
|
{{#vars}}{{#isEnum}}
|
||||||
|
|
||||||
|
{{>enumClass}}{{/isEnum}}{{#items.isEnum}}{{#items}}
|
||||||
|
|
||||||
|
{{>enumClass}}{{/items}}{{/items.isEnum}}
|
||||||
|
private {{{datatypeWithEnum}}} {{name}} = {{{defaultValue}}};{{/vars}}
|
||||||
|
|
||||||
|
{{#vars}}
|
||||||
|
/**{{#description}}
|
||||||
|
* {{{description}}}{{/description}}{{#minimum}}
|
||||||
|
* minimum: {{minimum}}{{/minimum}}{{#maximum}}
|
||||||
|
* maximum: {{maximum}}{{/maximum}}
|
||||||
|
**/
|
||||||
|
public {{classname}} {{name}}({{{datatypeWithEnum}}} {{name}}) {
|
||||||
|
this.{{name}} = {{name}};
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
{{#vendorExtensions.extraAnnotation}}{{vendorExtensions.extraAnnotation}}{{/vendorExtensions.extraAnnotation}}
|
||||||
|
@ApiModelProperty({{#example}}example = "{{example}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}")
|
||||||
|
@JsonProperty("{{baseName}}")
|
||||||
|
public {{{datatypeWithEnum}}} {{getter}}() {
|
||||||
|
return {{name}};
|
||||||
|
}
|
||||||
|
public void {{setter}}({{{datatypeWithEnum}}} {{name}}) {
|
||||||
|
this.{{name}} = {{name}};
|
||||||
|
}
|
||||||
|
|
||||||
|
{{/vars}}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (o == null || getClass() != o.getClass()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
{{classname}} {{classVarName}} = ({{classname}}) o;{{#hasVars}}
|
||||||
|
return {{#vars}}Objects.equals({{name}}, {{classVarName}}.{{name}}){{#hasMore}} &&
|
||||||
|
{{/hasMore}}{{^hasMore}};{{/hasMore}}{{/vars}}{{/hasVars}}{{^hasVars}}
|
||||||
|
return true;{{/hasVars}}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash({{#vars}}{{name}}{{#hasMore}}, {{/hasMore}}{{/vars}});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append("class {{classname}} {\n");
|
||||||
|
{{#parent}}sb.append(" ").append(toIndentedString(super.toString())).append("\n");{{/parent}}
|
||||||
|
{{#vars}}sb.append(" {{name}}: ").append(toIndentedString({{name}})).append("\n");
|
||||||
|
{{/vars}}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,145 @@
|
|||||||
|
<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>{{groupId}}</groupId>
|
||||||
|
<artifactId>{{artifactId}}</artifactId>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
<name>{{artifactId}}</name>
|
||||||
|
<version>{{artifactVersion}}</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.eclipse.jetty</groupId>
|
||||||
|
<artifactId>jetty-maven-plugin</artifactId>
|
||||||
|
<version>${jetty-version}</version>
|
||||||
|
<configuration>
|
||||||
|
<webApp>
|
||||||
|
<contextPath>/</contextPath>
|
||||||
|
</webApp>
|
||||||
|
<webAppSourceDirectory>target/${project.artifactId}-${project.version}</webAppSourceDirectory>
|
||||||
|
<stopPort>8079</stopPort>
|
||||||
|
<stopKey>stopit</stopKey>
|
||||||
|
<httpConnector>
|
||||||
|
<port>{{serverPort}}</port>
|
||||||
|
<idleTimeout>60000</idleTimeout>
|
||||||
|
</httpConnector>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>start-jetty</id>
|
||||||
|
<phase>pre-integration-test</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>start</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<scanIntervalSeconds>0</scanIntervalSeconds>
|
||||||
|
<daemon>true</daemon>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
<execution>
|
||||||
|
<id>stop-jetty</id>
|
||||||
|
<phase>post-integration-test</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>stop</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>io.swagger</groupId>
|
||||||
|
<artifactId>swagger-jersey2-jaxrs</artifactId>
|
||||||
|
<scope>compile</scope>
|
||||||
|
<version>${swagger-core-version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>ch.qos.logback</groupId>
|
||||||
|
<artifactId>logback-classic</artifactId>
|
||||||
|
<version>${logback-version}</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>ch.qos.logback</groupId>
|
||||||
|
<artifactId>logback-core</artifactId>
|
||||||
|
<version>${logback-version}</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
<version>${junit-version}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.servlet</groupId>
|
||||||
|
<artifactId>servlet-api</artifactId>
|
||||||
|
<version>${servlet-api-version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.glassfish.jersey.containers</groupId>
|
||||||
|
<artifactId>jersey-container-servlet-core</artifactId>
|
||||||
|
<version>${jersey2-version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.glassfish.jersey.media</groupId>
|
||||||
|
<artifactId>jersey-media-multipart</artifactId>
|
||||||
|
<version>${jersey2-version}</version>
|
||||||
|
</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.8</swagger-core-version>
|
||||||
|
<jetty-version>9.2.9.v20150224</jetty-version>
|
||||||
|
<jersey2-version>2.6</jersey2-version>
|
||||||
|
<slf4j-version>1.6.3</slf4j-version>
|
||||||
|
<junit-version>4.8.1</junit-version>
|
||||||
|
<logback-version>1.0.1</logback-version>
|
||||||
|
<servlet-api-version>2.5</servlet-api-version>
|
||||||
|
</properties>
|
||||||
|
</project>
|
@ -0,0 +1 @@
|
|||||||
|
sbt.version=0.12.0
|
@ -0,0 +1,9 @@
|
|||||||
|
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.8.4")
|
||||||
|
|
||||||
|
libraryDependencies <+= sbtVersion(v => v match {
|
||||||
|
case "0.11.0" => "com.github.siasia" %% "xsbt-web-plugin" % "0.11.0-0.2.8"
|
||||||
|
case "0.11.1" => "com.github.siasia" %% "xsbt-web-plugin" % "0.11.1-0.2.10"
|
||||||
|
case "0.11.2" => "com.github.siasia" %% "xsbt-web-plugin" % "0.11.2-0.2.11"
|
||||||
|
case "0.11.3" => "com.github.siasia" %% "xsbt-web-plugin" % "0.11.3-0.2.11.1"
|
||||||
|
case x if (x.startsWith("0.12")) => "com.github.siasia" %% "xsbt-web-plugin" % "0.12.0-0.2.11.1"
|
||||||
|
})
|
@ -0,0 +1 @@
|
|||||||
|
{{#isQueryParam}}@ApiParam(value = "{{{description}}}"{{#required}},required=true{{/required}}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}){{#defaultValue}} @DefaultValue("{{{defaultValue}}}"){{/defaultValue}} @QueryParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/isQueryParam}}
|
@ -0,0 +1 @@
|
|||||||
|
{{#returnContainer}}{{#isMapContainer}}Map<String, {{{returnType}}}>{{/isMapContainer}}{{#isListContainer}}List<{{{returnType}}}>{{/isListContainer}}{{/returnContainer}}{{^returnContainer}}{{{returnType}}}{{/returnContainer}}
|
@ -0,0 +1 @@
|
|||||||
|
{{#isBodyParam}}{{{dataType}}} {{paramName}}{{/isBodyParam}}
|
@ -0,0 +1 @@
|
|||||||
|
{{#isFormParam}}{{#notFile}}{{{dataType}}} {{paramName}}{{/notFile}}{{#isFile}}InputStream inputStream, FormDataContentDisposition fileDetail{{/isFile}}{{/isFormParam}}
|
@ -0,0 +1 @@
|
|||||||
|
{{#isHeaderParam}}{{{dataType}}} {{paramName}}{{/isHeaderParam}}
|
@ -0,0 +1 @@
|
|||||||
|
{{#isPathParam}}{{{dataType}}} {{paramName}}{{/isPathParam}}
|
@ -0,0 +1 @@
|
|||||||
|
{{#isQueryParam}}{{{dataType}}} {{paramName}}{{/isQueryParam}}
|
@ -0,0 +1,63 @@
|
|||||||
|
<?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">
|
||||||
|
|
||||||
|
<servlet>
|
||||||
|
<servlet-name>jersey</servlet-name>
|
||||||
|
<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
|
||||||
|
<init-param>
|
||||||
|
<param-name>jersey.config.server.provider.packages</param-name>
|
||||||
|
<param-value>
|
||||||
|
io.swagger.jaxrs.listing,
|
||||||
|
io.swagger.sample.resource,
|
||||||
|
{{apiPackage}}
|
||||||
|
</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>jersey.config.server.provider.classnames</param-name>
|
||||||
|
<param-value>org.glassfish.jersey.media.multipart.MultiPartFeature</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>jersey.config.server.wadl.disableWadl</param-name>
|
||||||
|
<param-value>true</param-value>
|
||||||
|
</init-param>
|
||||||
|
<load-on-startup>1</load-on-startup>
|
||||||
|
</servlet>
|
||||||
|
|
||||||
|
<servlet>
|
||||||
|
<servlet-name>Jersey2Config</servlet-name>
|
||||||
|
<servlet-class>io.swagger.jersey.config.JerseyJaxrsConfig</servlet-class>
|
||||||
|
<init-param>
|
||||||
|
<param-name>api.version</param-name>
|
||||||
|
<param-value>1.0.0</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>swagger.api.title</param-name>
|
||||||
|
<param-value>{{{title}}}</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>swagger.api.basepath</param-name>
|
||||||
|
<param-value>{{basePath}}</param-value>
|
||||||
|
</init-param>
|
||||||
|
|
||||||
|
<load-on-startup>2</load-on-startup>
|
||||||
|
</servlet>
|
||||||
|
<servlet>
|
||||||
|
<servlet-name>Bootstrap</servlet-name>
|
||||||
|
<servlet-class>{{apiPackage}}.Bootstrap</servlet-class>
|
||||||
|
<load-on-startup>2</load-on-startup>
|
||||||
|
</servlet>
|
||||||
|
<servlet-mapping>
|
||||||
|
<servlet-name>jersey</servlet-name>
|
||||||
|
<url-pattern>{{contextPath}}/*</url-pattern>
|
||||||
|
</servlet-mapping>
|
||||||
|
<filter>
|
||||||
|
<filter-name>ApiOriginFilter</filter-name>
|
||||||
|
<filter-class>{{apiPackage}}.ApiOriginFilter</filter-class>
|
||||||
|
</filter>
|
||||||
|
<filter-mapping>
|
||||||
|
<filter-name>ApiOriginFilter</filter-name>
|
||||||
|
<url-pattern>/*</url-pattern>
|
||||||
|
</filter-mapping>
|
||||||
|
</web-app>
|
@ -110,7 +110,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.swagger</groupId>
|
<groupId>io.swagger</groupId>
|
||||||
<artifactId>swagger-annotations</artifactId>
|
<artifactId>swagger-annotations</artifactId>
|
||||||
<version>${swagger-annotations-version}</version>
|
<version>${swagger-core-version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.code.gson</groupId>
|
<groupId>com.google.code.gson</groupId>
|
||||||
@ -145,7 +145,7 @@
|
|||||||
</repository>
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
<properties>
|
<properties>
|
||||||
<swagger-annotations-version>1.5.4</swagger-annotations-version>
|
<swagger-core-version>1.5.8</swagger-core-version>
|
||||||
<gson-version>2.3.1</gson-version>
|
<gson-version>2.3.1</gson-version>
|
||||||
<junit-version>4.8.1</junit-version>
|
<junit-version>4.8.1</junit-version>
|
||||||
<maven-plugin-version>1.0.0</maven-plugin-version>
|
<maven-plugin-version>1.0.0</maven-plugin-version>
|
||||||
|
@ -27,7 +27,8 @@ public class JaxRSServerOptionsProvider extends JavaOptionsProvider {
|
|||||||
builder.putAll(options)
|
builder.putAll(options)
|
||||||
.put(CodegenConstants.IMPL_FOLDER, IMPL_FOLDER_VALUE)
|
.put(CodegenConstants.IMPL_FOLDER, IMPL_FOLDER_VALUE)
|
||||||
//.put(JavaJaxRSJersey1ServerCodegen.DATE_LIBRARY, "joda") //java.lang.IllegalArgumentException: Multiple entries with same key: dateLibrary=joda and dateLibrary=joda
|
//.put(JavaJaxRSJersey1ServerCodegen.DATE_LIBRARY, "joda") //java.lang.IllegalArgumentException: Multiple entries with same key: dateLibrary=joda and dateLibrary=joda
|
||||||
.put("title", "Test title");
|
.put("title", "Test title")
|
||||||
|
.put("showGenerationTimestamp", "true");
|
||||||
|
|
||||||
return builder.build();
|
return builder.build();
|
||||||
}
|
}
|
||||||
|
698
modules/swagger-codegen/src/test/resources/2_0/petstore.yaml
Normal file
698
modules/swagger-codegen/src/test/resources/2_0/petstore.yaml
Normal file
@ -0,0 +1,698 @@
|
|||||||
|
swagger: '2.0'
|
||||||
|
info:
|
||||||
|
description: |
|
||||||
|
This is a sample server Petstore server. You can find out more about
|
||||||
|
Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/).
|
||||||
|
For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||||
|
version: '1.0.0'
|
||||||
|
title: Swagger Petstore
|
||||||
|
termsOfService: http://swagger.io/terms/
|
||||||
|
contact:
|
||||||
|
email: apiteam@swagger.io
|
||||||
|
license:
|
||||||
|
name: Apache 2.0
|
||||||
|
url: http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
host: petstore.swagger.io
|
||||||
|
basePath: /v2
|
||||||
|
tags:
|
||||||
|
- name: pet
|
||||||
|
description: Everything about your Pets
|
||||||
|
externalDocs:
|
||||||
|
description: Find out more
|
||||||
|
url: http://swagger.io
|
||||||
|
- name: store
|
||||||
|
description: Access to Petstore orders
|
||||||
|
- name: user
|
||||||
|
description: Operations about user
|
||||||
|
externalDocs:
|
||||||
|
description: Find out more about our store
|
||||||
|
url: http://swagger.io
|
||||||
|
schemes:
|
||||||
|
- http
|
||||||
|
paths:
|
||||||
|
/pet:
|
||||||
|
post:
|
||||||
|
tags:
|
||||||
|
- pet
|
||||||
|
summary: Add a new pet to the store
|
||||||
|
operationId: addPet
|
||||||
|
consumes:
|
||||||
|
- application/json
|
||||||
|
- application/xml
|
||||||
|
produces:
|
||||||
|
- application/xml
|
||||||
|
- application/json
|
||||||
|
parameters:
|
||||||
|
- in: body
|
||||||
|
name: body
|
||||||
|
description: Pet object that needs to be added to the store
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/Pet'
|
||||||
|
responses:
|
||||||
|
405:
|
||||||
|
description: Invalid input
|
||||||
|
security:
|
||||||
|
- petstore_auth:
|
||||||
|
- write:pets
|
||||||
|
- read:pets
|
||||||
|
put:
|
||||||
|
tags:
|
||||||
|
- pet
|
||||||
|
summary: Update an existing pet
|
||||||
|
operationId: updatePet
|
||||||
|
consumes:
|
||||||
|
- application/json
|
||||||
|
- application/xml
|
||||||
|
produces:
|
||||||
|
- application/xml
|
||||||
|
- application/json
|
||||||
|
parameters:
|
||||||
|
- in: body
|
||||||
|
name: body
|
||||||
|
description: Pet object that needs to be added to the store
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/Pet'
|
||||||
|
responses:
|
||||||
|
400:
|
||||||
|
description: Invalid ID supplied
|
||||||
|
404:
|
||||||
|
description: Pet not found
|
||||||
|
405:
|
||||||
|
description: Validation exception
|
||||||
|
security:
|
||||||
|
- petstore_auth:
|
||||||
|
- write:pets
|
||||||
|
- read:pets
|
||||||
|
/pet/findByStatus:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- pet
|
||||||
|
summary: Finds Pets by status
|
||||||
|
description: Multiple status values can be provided with comma separated strings
|
||||||
|
operationId: findPetsByStatus
|
||||||
|
produces:
|
||||||
|
- application/xml
|
||||||
|
- application/json
|
||||||
|
parameters:
|
||||||
|
- name: status
|
||||||
|
in: query
|
||||||
|
description: Status values that need to be considered for filter
|
||||||
|
required: true
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
enum:
|
||||||
|
- available
|
||||||
|
- pending
|
||||||
|
- sold
|
||||||
|
default: available
|
||||||
|
collectionFormat: multi
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
description: successful operation
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/definitions/Pet'
|
||||||
|
400:
|
||||||
|
description: Invalid status value
|
||||||
|
security:
|
||||||
|
- petstore_auth:
|
||||||
|
- write:pets
|
||||||
|
- read:pets
|
||||||
|
/pet/findByTags:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- pet
|
||||||
|
summary: Finds Pets by tags
|
||||||
|
description: |
|
||||||
|
Muliple tags can be provided with comma separated strings. Use
|
||||||
|
tag1, tag2, tag3 for testing.
|
||||||
|
operationId: findPetsByTags
|
||||||
|
produces:
|
||||||
|
- application/xml
|
||||||
|
- application/json
|
||||||
|
parameters:
|
||||||
|
- name: tags
|
||||||
|
in: query
|
||||||
|
description: Tags to filter by
|
||||||
|
required: true
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
collectionFormat: multi
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
description: successful operation
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/definitions/Pet'
|
||||||
|
400:
|
||||||
|
description: Invalid tag value
|
||||||
|
security:
|
||||||
|
- petstore_auth:
|
||||||
|
- write:pets
|
||||||
|
- read:pets
|
||||||
|
deprecated: true
|
||||||
|
/pet/{petId}:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- pet
|
||||||
|
summary: Find pet by ID
|
||||||
|
description: Returns a single pet
|
||||||
|
operationId: getPetById
|
||||||
|
produces:
|
||||||
|
- application/xml
|
||||||
|
- application/json
|
||||||
|
parameters:
|
||||||
|
- name: petId
|
||||||
|
in: path
|
||||||
|
description: ID of pet to return
|
||||||
|
required: true
|
||||||
|
type: integer
|
||||||
|
format: int64
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
description: successful operation
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/Pet'
|
||||||
|
400:
|
||||||
|
description: Invalid ID supplied
|
||||||
|
404:
|
||||||
|
description: Pet not found
|
||||||
|
security:
|
||||||
|
- api_key: []
|
||||||
|
post:
|
||||||
|
tags:
|
||||||
|
- pet
|
||||||
|
summary: Updates a pet in the store with form data
|
||||||
|
description:
|
||||||
|
operationId: updatePetWithForm
|
||||||
|
consumes:
|
||||||
|
- application/x-www-form-urlencoded
|
||||||
|
produces:
|
||||||
|
- application/xml
|
||||||
|
- application/json
|
||||||
|
parameters:
|
||||||
|
- name: petId
|
||||||
|
in: path
|
||||||
|
description: ID of pet that needs to be updated
|
||||||
|
required: true
|
||||||
|
type: integer
|
||||||
|
format: int64
|
||||||
|
- name: name
|
||||||
|
in: formData
|
||||||
|
description: Updated name of the pet
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
- name: status
|
||||||
|
in: formData
|
||||||
|
description: Updated status of the pet
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
responses:
|
||||||
|
405:
|
||||||
|
description: Invalid input
|
||||||
|
security:
|
||||||
|
- petstore_auth:
|
||||||
|
- write:pets
|
||||||
|
- read:pets
|
||||||
|
delete:
|
||||||
|
tags:
|
||||||
|
- pet
|
||||||
|
summary: Deletes a pet
|
||||||
|
operationId: deletePet
|
||||||
|
produces:
|
||||||
|
- application/xml
|
||||||
|
- application/json
|
||||||
|
parameters:
|
||||||
|
- name: api_key
|
||||||
|
in: header
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
- name: petId
|
||||||
|
in: path
|
||||||
|
description: Pet id to delete
|
||||||
|
required: true
|
||||||
|
type: integer
|
||||||
|
format: int64
|
||||||
|
responses:
|
||||||
|
400:
|
||||||
|
description: Invalid ID supplied
|
||||||
|
404:
|
||||||
|
description: Pet not found
|
||||||
|
security:
|
||||||
|
- petstore_auth:
|
||||||
|
- write:pets
|
||||||
|
- read:pets
|
||||||
|
/pet/{petId}/uploadImage:
|
||||||
|
post:
|
||||||
|
tags:
|
||||||
|
- pet
|
||||||
|
summary: uploads an image
|
||||||
|
operationId: uploadFile
|
||||||
|
consumes:
|
||||||
|
- multipart/form-data
|
||||||
|
produces:
|
||||||
|
- application/json
|
||||||
|
parameters:
|
||||||
|
- name: petId
|
||||||
|
in: path
|
||||||
|
description: ID of pet to update
|
||||||
|
required: true
|
||||||
|
type: integer
|
||||||
|
format: int64
|
||||||
|
- name: additionalMetadata
|
||||||
|
in: formData
|
||||||
|
description: Additional data to pass to server
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
- name: file
|
||||||
|
in: formData
|
||||||
|
description: file to upload
|
||||||
|
required: false
|
||||||
|
type: file
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
description: successful operation
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/ApiResponse'
|
||||||
|
security:
|
||||||
|
- petstore_auth:
|
||||||
|
- write:pets
|
||||||
|
- read:pets
|
||||||
|
/store/inventory:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- store
|
||||||
|
summary: Returns pet inventories by status
|
||||||
|
description: Returns a map of status codes to quantities
|
||||||
|
operationId: getInventory
|
||||||
|
produces:
|
||||||
|
- application/json
|
||||||
|
parameters: []
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
description: successful operation
|
||||||
|
schema:
|
||||||
|
type: object
|
||||||
|
additionalProperties:
|
||||||
|
type: integer
|
||||||
|
format: int32
|
||||||
|
security:
|
||||||
|
- api_key: []
|
||||||
|
/store/order:
|
||||||
|
post:
|
||||||
|
tags:
|
||||||
|
- store
|
||||||
|
summary: Place an order for a pet
|
||||||
|
operationId: placeOrder
|
||||||
|
produces:
|
||||||
|
- application/xml
|
||||||
|
- application/json
|
||||||
|
parameters:
|
||||||
|
- in: body
|
||||||
|
name: body
|
||||||
|
description: order placed for purchasing the pet
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/Order'
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
description: successful operation
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/Order'
|
||||||
|
400:
|
||||||
|
description: Invalid Order
|
||||||
|
/store/order/{orderId}:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- store
|
||||||
|
summary: Find purchase order by ID
|
||||||
|
description: |
|
||||||
|
For valid response try integer IDs with value >= 1 and <= 10.
|
||||||
|
Other values will generated exceptions
|
||||||
|
operationId: getOrderById
|
||||||
|
produces:
|
||||||
|
- application/xml
|
||||||
|
- application/json
|
||||||
|
parameters:
|
||||||
|
- name: orderId
|
||||||
|
in: path
|
||||||
|
description: ID of pet that needs to be fetched
|
||||||
|
required: true
|
||||||
|
type: integer
|
||||||
|
maximum: 10.0
|
||||||
|
minimum: 1.0
|
||||||
|
format: int64
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
description: successful operation
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/Order'
|
||||||
|
400:
|
||||||
|
description: Invalid ID supplied
|
||||||
|
404:
|
||||||
|
description: Order not found
|
||||||
|
delete:
|
||||||
|
tags:
|
||||||
|
- store
|
||||||
|
summary: Delete purchase order by ID
|
||||||
|
description: For valid response try integer IDs with positive integer value.\
|
||||||
|
\ Negative or non-integer values will generate API errors
|
||||||
|
operationId: deleteOrder
|
||||||
|
produces:
|
||||||
|
- application/xml
|
||||||
|
- application/json
|
||||||
|
parameters:
|
||||||
|
- name: orderId
|
||||||
|
in: path
|
||||||
|
description: ID of the order that needs to be deleted
|
||||||
|
required: true
|
||||||
|
type: integer
|
||||||
|
minimum: 1.0
|
||||||
|
format: int64
|
||||||
|
responses:
|
||||||
|
400:
|
||||||
|
description: Invalid ID supplied
|
||||||
|
404:
|
||||||
|
description: Order not found
|
||||||
|
/user:
|
||||||
|
post:
|
||||||
|
tags:
|
||||||
|
- user
|
||||||
|
summary: Create user
|
||||||
|
description: This can only be done by the logged in user.
|
||||||
|
operationId: createUser
|
||||||
|
produces:
|
||||||
|
- application/xml
|
||||||
|
- application/json
|
||||||
|
parameters:
|
||||||
|
- in: body
|
||||||
|
name: body
|
||||||
|
description: Created user object
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/User'
|
||||||
|
responses:
|
||||||
|
default:
|
||||||
|
description: successful operation
|
||||||
|
/user/createWithArray:
|
||||||
|
post:
|
||||||
|
tags:
|
||||||
|
- user
|
||||||
|
summary: Creates list of users with given input array
|
||||||
|
operationId: createUsersWithArrayInput
|
||||||
|
produces:
|
||||||
|
- application/xml
|
||||||
|
- application/json
|
||||||
|
parameters:
|
||||||
|
- in: body
|
||||||
|
name: body
|
||||||
|
description: List of user object
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/definitions/User'
|
||||||
|
responses:
|
||||||
|
default:
|
||||||
|
description: successful operation
|
||||||
|
/user/createWithList:
|
||||||
|
post:
|
||||||
|
tags:
|
||||||
|
- user
|
||||||
|
summary: Creates list of users with given input array
|
||||||
|
operationId: createUsersWithListInput
|
||||||
|
produces:
|
||||||
|
- application/xml
|
||||||
|
- application/json
|
||||||
|
parameters:
|
||||||
|
- in: body
|
||||||
|
name: body
|
||||||
|
description: List of user object
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/definitions/User'
|
||||||
|
responses:
|
||||||
|
default:
|
||||||
|
description: successful operation
|
||||||
|
/user/login:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- user
|
||||||
|
summary: Logs user into the system
|
||||||
|
operationId: loginUser
|
||||||
|
produces:
|
||||||
|
- application/xml
|
||||||
|
- application/json
|
||||||
|
parameters:
|
||||||
|
- name: username
|
||||||
|
in: query
|
||||||
|
description: The user name for login
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
- name: password
|
||||||
|
in: query
|
||||||
|
description: The password for login in clear text
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
description: successful operation
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
headers:
|
||||||
|
X-Rate-Limit:
|
||||||
|
type: integer
|
||||||
|
format: int32
|
||||||
|
description: calls per hour allowed by the user
|
||||||
|
X-Expires-After:
|
||||||
|
type: string
|
||||||
|
format: date-time
|
||||||
|
description: date in UTC when token expires
|
||||||
|
400:
|
||||||
|
description: Invalid username/password supplied
|
||||||
|
/user/logout:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- user
|
||||||
|
summary: Logs out current logged in user session
|
||||||
|
description:
|
||||||
|
operationId: logoutUser
|
||||||
|
produces:
|
||||||
|
- application/xml
|
||||||
|
- application/json
|
||||||
|
parameters: []
|
||||||
|
responses:
|
||||||
|
default:
|
||||||
|
description: successful operation
|
||||||
|
/user/{username}:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- user
|
||||||
|
summary: Get user by user name
|
||||||
|
operationId: getUserByName
|
||||||
|
produces:
|
||||||
|
- application/xml
|
||||||
|
- application/json
|
||||||
|
parameters:
|
||||||
|
- name: username
|
||||||
|
in: path
|
||||||
|
description: The name that needs to be fetched. Use user1 for testing.
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
description: successful operation
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/User'
|
||||||
|
400:
|
||||||
|
description: Invalid username supplied
|
||||||
|
404:
|
||||||
|
description: User not found
|
||||||
|
put:
|
||||||
|
tags:
|
||||||
|
- user
|
||||||
|
summary: Updated user
|
||||||
|
description: This can only be done by the logged in user.
|
||||||
|
operationId: updateUser
|
||||||
|
produces:
|
||||||
|
- application/xml
|
||||||
|
- application/json
|
||||||
|
parameters:
|
||||||
|
- name: username
|
||||||
|
in: path
|
||||||
|
description: name that need to be updated
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
- in: body
|
||||||
|
name: body
|
||||||
|
description: Updated user object
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/User'
|
||||||
|
responses:
|
||||||
|
400:
|
||||||
|
description: Invalid user supplied
|
||||||
|
404:
|
||||||
|
description: User not found
|
||||||
|
delete:
|
||||||
|
tags:
|
||||||
|
- user
|
||||||
|
summary: Delete user
|
||||||
|
description: This can only be done by the logged in user.
|
||||||
|
operationId: deleteUser
|
||||||
|
produces:
|
||||||
|
- application/xml
|
||||||
|
- application/json
|
||||||
|
parameters:
|
||||||
|
- name: username
|
||||||
|
in: path
|
||||||
|
description: The name that needs to be deleted
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
responses:
|
||||||
|
400:
|
||||||
|
description: Invalid username supplied
|
||||||
|
404:
|
||||||
|
description: User not found
|
||||||
|
securityDefinitions:
|
||||||
|
petstore_auth:
|
||||||
|
type: oauth2
|
||||||
|
authorizationUrl: http://petstore.swagger.io/oauth/dialog
|
||||||
|
flow: implicit
|
||||||
|
scopes:
|
||||||
|
write:pets: modify pets in your account
|
||||||
|
read:pets: read your pets
|
||||||
|
api_key:
|
||||||
|
type: apiKey
|
||||||
|
name: api_key
|
||||||
|
in: header
|
||||||
|
definitions:
|
||||||
|
Order:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
id:
|
||||||
|
type: integer
|
||||||
|
format: int64
|
||||||
|
petId:
|
||||||
|
type: integer
|
||||||
|
format: int64
|
||||||
|
quantity:
|
||||||
|
type: integer
|
||||||
|
format: int32
|
||||||
|
shipDate:
|
||||||
|
type: string
|
||||||
|
format: date-time
|
||||||
|
status:
|
||||||
|
type: string
|
||||||
|
description: Order Status
|
||||||
|
enum:
|
||||||
|
- placed
|
||||||
|
- approved
|
||||||
|
- delivered
|
||||||
|
complete:
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
|
xml:
|
||||||
|
name: Order
|
||||||
|
User:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
id:
|
||||||
|
type: integer
|
||||||
|
format: int64
|
||||||
|
username:
|
||||||
|
type: string
|
||||||
|
firstName:
|
||||||
|
type: string
|
||||||
|
lastName:
|
||||||
|
type: string
|
||||||
|
email:
|
||||||
|
type: string
|
||||||
|
password:
|
||||||
|
type: string
|
||||||
|
phone:
|
||||||
|
type: string
|
||||||
|
userStatus:
|
||||||
|
type: integer
|
||||||
|
format: int32
|
||||||
|
description: User Status
|
||||||
|
xml:
|
||||||
|
name: User
|
||||||
|
Category:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
id:
|
||||||
|
type: integer
|
||||||
|
format: int64
|
||||||
|
name:
|
||||||
|
type: string
|
||||||
|
xml:
|
||||||
|
name: Category
|
||||||
|
Tag:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
id:
|
||||||
|
type: integer
|
||||||
|
format: int64
|
||||||
|
name:
|
||||||
|
type: string
|
||||||
|
xml:
|
||||||
|
name: Tag
|
||||||
|
Pet:
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- name
|
||||||
|
- photoUrls
|
||||||
|
properties:
|
||||||
|
id:
|
||||||
|
type: integer
|
||||||
|
format: int64
|
||||||
|
category:
|
||||||
|
$ref: '#/definitions/Category'
|
||||||
|
name:
|
||||||
|
type: string
|
||||||
|
example: doggie
|
||||||
|
photoUrls:
|
||||||
|
type: array
|
||||||
|
xml:
|
||||||
|
name: photoUrl
|
||||||
|
wrapped: true
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
tags:
|
||||||
|
type: array
|
||||||
|
xml:
|
||||||
|
name: tag
|
||||||
|
wrapped: true
|
||||||
|
items:
|
||||||
|
$ref: '#/definitions/Tag'
|
||||||
|
status:
|
||||||
|
type: string
|
||||||
|
description: pet status in the store
|
||||||
|
enum:
|
||||||
|
- available
|
||||||
|
- pending
|
||||||
|
- sold
|
||||||
|
xml:
|
||||||
|
name: Pet
|
||||||
|
ApiResponse:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
code:
|
||||||
|
type: integer
|
||||||
|
format: int32
|
||||||
|
type:
|
||||||
|
type: string
|
||||||
|
message:
|
||||||
|
type: string
|
||||||
|
externalDocs:
|
||||||
|
description: Find out more about Swagger
|
||||||
|
url: http://swagger.io
|
@ -1,576 +0,0 @@
|
|||||||
swagger: "2.0"
|
|
||||||
info:
|
|
||||||
description: |
|
|
||||||
This is a sample server Petstore server.
|
|
||||||
|
|
||||||
[Learn about Swagger](http://swagger.io) or join the IRC channel `#swagger` on irc.freenode.net.
|
|
||||||
|
|
||||||
For this sample, you can use the api key `special-key` to test the authorization filters
|
|
||||||
version: "1.0.0"
|
|
||||||
title: Swagger Petstore
|
|
||||||
termsOfService: http://helloreverb.com/terms/
|
|
||||||
contact:
|
|
||||||
name: apiteam@swagger.io
|
|
||||||
license:
|
|
||||||
name: Apache 2.0
|
|
||||||
url: http://www.apache.org/licenses/LICENSE-2.0.html
|
|
||||||
host: petstore.swagger.io
|
|
||||||
basePath: /v2
|
|
||||||
schemes:
|
|
||||||
- http
|
|
||||||
paths:
|
|
||||||
/pets:
|
|
||||||
post:
|
|
||||||
tags:
|
|
||||||
- pet
|
|
||||||
summary: Add a new pet to the store
|
|
||||||
description: ""
|
|
||||||
operationId: addPet
|
|
||||||
consumes:
|
|
||||||
- application/json
|
|
||||||
- application/xml
|
|
||||||
produces:
|
|
||||||
- application/json
|
|
||||||
- application/xml
|
|
||||||
parameters:
|
|
||||||
- in: body
|
|
||||||
name: body
|
|
||||||
description: Pet object that needs to be added to the store
|
|
||||||
required: false
|
|
||||||
schema:
|
|
||||||
$ref: "#/definitions/Pet"
|
|
||||||
responses:
|
|
||||||
"405":
|
|
||||||
description: Invalid input
|
|
||||||
security:
|
|
||||||
- petstore_auth:
|
|
||||||
- write_pets
|
|
||||||
- read_pets
|
|
||||||
put:
|
|
||||||
tags:
|
|
||||||
- pet
|
|
||||||
summary: Update an existing pet
|
|
||||||
description: ""
|
|
||||||
operationId: updatePet
|
|
||||||
consumes:
|
|
||||||
- application/json
|
|
||||||
- application/xml
|
|
||||||
produces:
|
|
||||||
- application/json
|
|
||||||
- application/xml
|
|
||||||
parameters:
|
|
||||||
- in: body
|
|
||||||
name: body
|
|
||||||
description: Pet object that needs to be added to the store
|
|
||||||
required: false
|
|
||||||
schema:
|
|
||||||
$ref: "#/definitions/Pet"
|
|
||||||
responses:
|
|
||||||
"405":
|
|
||||||
description: Validation exception
|
|
||||||
"404":
|
|
||||||
description: Pet not found
|
|
||||||
"400":
|
|
||||||
description: Invalid ID supplied
|
|
||||||
security:
|
|
||||||
- petstore_auth:
|
|
||||||
- write_pets
|
|
||||||
- read_pets
|
|
||||||
/pets/findByStatus:
|
|
||||||
get:
|
|
||||||
tags:
|
|
||||||
- pet
|
|
||||||
summary: Finds Pets by status
|
|
||||||
description: Multiple status values can be provided with comma seperated strings
|
|
||||||
operationId: findPetsByStatus
|
|
||||||
produces:
|
|
||||||
- application/json
|
|
||||||
- application/xml
|
|
||||||
parameters:
|
|
||||||
- in: query
|
|
||||||
name: status
|
|
||||||
description: Status values that need to be considered for filter
|
|
||||||
required: false
|
|
||||||
type: array
|
|
||||||
items:
|
|
||||||
type: string
|
|
||||||
collectionFormat: multi
|
|
||||||
responses:
|
|
||||||
"200":
|
|
||||||
description: successful operation
|
|
||||||
schema:
|
|
||||||
type: array
|
|
||||||
items:
|
|
||||||
$ref: "#/definitions/Pet"
|
|
||||||
"400":
|
|
||||||
description: Invalid status value
|
|
||||||
security:
|
|
||||||
- petstore_auth:
|
|
||||||
- write_pets
|
|
||||||
- read_pets
|
|
||||||
/pets/findByTags:
|
|
||||||
get:
|
|
||||||
tags:
|
|
||||||
- pet
|
|
||||||
summary: Finds Pets by tags
|
|
||||||
description: Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.
|
|
||||||
operationId: findPetsByTags
|
|
||||||
produces:
|
|
||||||
- application/json
|
|
||||||
- application/xml
|
|
||||||
parameters:
|
|
||||||
- in: query
|
|
||||||
name: tags
|
|
||||||
description: Tags to filter by
|
|
||||||
required: false
|
|
||||||
type: array
|
|
||||||
items:
|
|
||||||
type: string
|
|
||||||
collectionFormat: multi
|
|
||||||
responses:
|
|
||||||
"200":
|
|
||||||
description: successful operation
|
|
||||||
schema:
|
|
||||||
type: array
|
|
||||||
items:
|
|
||||||
$ref: "#/definitions/Pet"
|
|
||||||
"400":
|
|
||||||
description: Invalid tag value
|
|
||||||
security:
|
|
||||||
- petstore_auth:
|
|
||||||
- write_pets
|
|
||||||
- read_pets
|
|
||||||
/pets/{petId}:
|
|
||||||
get:
|
|
||||||
tags:
|
|
||||||
- pet
|
|
||||||
summary: Find pet by ID
|
|
||||||
description: Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
|
|
||||||
operationId: getPetById
|
|
||||||
produces:
|
|
||||||
- application/json
|
|
||||||
- application/xml
|
|
||||||
parameters:
|
|
||||||
- in: path
|
|
||||||
name: petId
|
|
||||||
description: ID of pet that needs to be fetched
|
|
||||||
required: true
|
|
||||||
type: integer
|
|
||||||
format: int64
|
|
||||||
responses:
|
|
||||||
"404":
|
|
||||||
description: Pet not found
|
|
||||||
"200":
|
|
||||||
description: successful operation
|
|
||||||
schema:
|
|
||||||
$ref: "#/definitions/Pet"
|
|
||||||
"400":
|
|
||||||
description: Invalid ID supplied
|
|
||||||
security:
|
|
||||||
- api_key: []
|
|
||||||
- petstore_auth:
|
|
||||||
- write_pets
|
|
||||||
- read_pets
|
|
||||||
post:
|
|
||||||
tags:
|
|
||||||
- pet
|
|
||||||
summary: Updates a pet in the store with form data
|
|
||||||
description: ""
|
|
||||||
operationId: updatePetWithForm
|
|
||||||
consumes:
|
|
||||||
- application/x-www-form-urlencoded
|
|
||||||
produces:
|
|
||||||
- application/json
|
|
||||||
- application/xml
|
|
||||||
parameters:
|
|
||||||
- in: path
|
|
||||||
name: petId
|
|
||||||
description: ID of pet that needs to be updated
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
- in: formData
|
|
||||||
name: name
|
|
||||||
description: Updated name of the pet
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
- in: formData
|
|
||||||
name: status
|
|
||||||
description: Updated status of the pet
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
responses:
|
|
||||||
"405":
|
|
||||||
description: Invalid input
|
|
||||||
security:
|
|
||||||
- petstore_auth:
|
|
||||||
- write_pets
|
|
||||||
- read_pets
|
|
||||||
delete:
|
|
||||||
tags:
|
|
||||||
- pet
|
|
||||||
summary: Deletes a pet
|
|
||||||
description: ""
|
|
||||||
operationId: deletePet
|
|
||||||
produces:
|
|
||||||
- application/json
|
|
||||||
- application/xml
|
|
||||||
parameters:
|
|
||||||
- in: header
|
|
||||||
name: api_key
|
|
||||||
description: ""
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
- in: path
|
|
||||||
name: petId
|
|
||||||
description: Pet id to delete
|
|
||||||
required: true
|
|
||||||
type: integer
|
|
||||||
format: int64
|
|
||||||
responses:
|
|
||||||
"400":
|
|
||||||
description: Invalid pet value
|
|
||||||
security:
|
|
||||||
- petstore_auth:
|
|
||||||
- write_pets
|
|
||||||
- read_pets
|
|
||||||
/stores/order:
|
|
||||||
post:
|
|
||||||
tags:
|
|
||||||
- store
|
|
||||||
summary: Place an order for a pet
|
|
||||||
description: ""
|
|
||||||
operationId: placeOrder
|
|
||||||
produces:
|
|
||||||
- application/json
|
|
||||||
- application/xml
|
|
||||||
parameters:
|
|
||||||
- in: body
|
|
||||||
name: body
|
|
||||||
description: order placed for purchasing the pet
|
|
||||||
required: false
|
|
||||||
schema:
|
|
||||||
$ref: "#/definitions/Order"
|
|
||||||
responses:
|
|
||||||
"200":
|
|
||||||
description: successful operation
|
|
||||||
schema:
|
|
||||||
$ref: "#/definitions/Order"
|
|
||||||
"400":
|
|
||||||
description: Invalid Order
|
|
||||||
/stores/order/{orderId}:
|
|
||||||
get:
|
|
||||||
tags:
|
|
||||||
- store
|
|
||||||
summary: Find purchase order by ID
|
|
||||||
description: For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
|
||||||
operationId: getOrderById
|
|
||||||
produces:
|
|
||||||
- application/json
|
|
||||||
- application/xml
|
|
||||||
parameters:
|
|
||||||
- in: path
|
|
||||||
name: orderId
|
|
||||||
description: ID of pet that needs to be fetched
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
responses:
|
|
||||||
"404":
|
|
||||||
description: Order not found
|
|
||||||
"200":
|
|
||||||
description: successful operation
|
|
||||||
schema:
|
|
||||||
$ref: "#/definitions/Order"
|
|
||||||
"400":
|
|
||||||
description: Invalid ID supplied
|
|
||||||
delete:
|
|
||||||
tags:
|
|
||||||
- store
|
|
||||||
summary: Delete purchase order by ID
|
|
||||||
description: For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
|
||||||
operationId: deleteOrder
|
|
||||||
produces:
|
|
||||||
- application/json
|
|
||||||
- application/xml
|
|
||||||
parameters:
|
|
||||||
- in: path
|
|
||||||
name: orderId
|
|
||||||
description: ID of the order that needs to be deleted
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
responses:
|
|
||||||
"404":
|
|
||||||
description: Order not found
|
|
||||||
"400":
|
|
||||||
description: Invalid ID supplied
|
|
||||||
/users:
|
|
||||||
post:
|
|
||||||
tags:
|
|
||||||
- user
|
|
||||||
summary: Create user
|
|
||||||
description: This can only be done by the logged in user.
|
|
||||||
operationId: createUser
|
|
||||||
produces:
|
|
||||||
- application/json
|
|
||||||
- application/xml
|
|
||||||
parameters:
|
|
||||||
- in: body
|
|
||||||
name: body
|
|
||||||
description: Created user object
|
|
||||||
required: false
|
|
||||||
schema:
|
|
||||||
$ref: "#/definitions/User"
|
|
||||||
responses:
|
|
||||||
default:
|
|
||||||
description: successful operation
|
|
||||||
/users/createWithArray:
|
|
||||||
post:
|
|
||||||
tags:
|
|
||||||
- user
|
|
||||||
summary: Creates list of users with given input array
|
|
||||||
description: ""
|
|
||||||
operationId: createUsersWithArrayInput
|
|
||||||
produces:
|
|
||||||
- application/json
|
|
||||||
- application/xml
|
|
||||||
parameters:
|
|
||||||
- in: body
|
|
||||||
name: body
|
|
||||||
description: List of user object
|
|
||||||
required: false
|
|
||||||
schema:
|
|
||||||
type: array
|
|
||||||
items:
|
|
||||||
$ref: "#/definitions/User"
|
|
||||||
responses:
|
|
||||||
default:
|
|
||||||
description: successful operation
|
|
||||||
/users/createWithList:
|
|
||||||
post:
|
|
||||||
tags:
|
|
||||||
- user
|
|
||||||
summary: Creates list of users with given input array
|
|
||||||
description: ""
|
|
||||||
operationId: createUsersWithListInput
|
|
||||||
produces:
|
|
||||||
- application/json
|
|
||||||
- application/xml
|
|
||||||
parameters:
|
|
||||||
- in: body
|
|
||||||
name: body
|
|
||||||
description: List of user object
|
|
||||||
required: false
|
|
||||||
schema:
|
|
||||||
type: array
|
|
||||||
items:
|
|
||||||
$ref: "#/definitions/User"
|
|
||||||
responses:
|
|
||||||
default:
|
|
||||||
description: successful operation
|
|
||||||
/users/login:
|
|
||||||
get:
|
|
||||||
tags:
|
|
||||||
- user
|
|
||||||
summary: Logs user into the system
|
|
||||||
description: ""
|
|
||||||
operationId: loginUser
|
|
||||||
produces:
|
|
||||||
- application/json
|
|
||||||
- application/xml
|
|
||||||
parameters:
|
|
||||||
- in: query
|
|
||||||
name: username
|
|
||||||
description: The user name for login
|
|
||||||
required: false
|
|
||||||
type: string
|
|
||||||
- in: query
|
|
||||||
name: password
|
|
||||||
description: The password for login in clear text
|
|
||||||
required: false
|
|
||||||
type: string
|
|
||||||
responses:
|
|
||||||
"200":
|
|
||||||
description: successful operation
|
|
||||||
schema:
|
|
||||||
type: string
|
|
||||||
"400":
|
|
||||||
description: Invalid username/password supplied
|
|
||||||
/users/logout:
|
|
||||||
get:
|
|
||||||
tags:
|
|
||||||
- user
|
|
||||||
summary: Logs out current logged in user session
|
|
||||||
description: ""
|
|
||||||
operationId: logoutUser
|
|
||||||
produces:
|
|
||||||
- application/json
|
|
||||||
- application/xml
|
|
||||||
responses:
|
|
||||||
default:
|
|
||||||
description: successful operation
|
|
||||||
/users/{username}:
|
|
||||||
get:
|
|
||||||
tags:
|
|
||||||
- user
|
|
||||||
summary: Get user by user name
|
|
||||||
description: ""
|
|
||||||
operationId: getUserByName
|
|
||||||
produces:
|
|
||||||
- application/json
|
|
||||||
- application/xml
|
|
||||||
parameters:
|
|
||||||
- in: path
|
|
||||||
name: username
|
|
||||||
description: The name that needs to be fetched. Use user1 for testing.
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
responses:
|
|
||||||
"404":
|
|
||||||
description: User not found
|
|
||||||
"200":
|
|
||||||
description: successful operation
|
|
||||||
schema:
|
|
||||||
$ref: "#/definitions/User"
|
|
||||||
"400":
|
|
||||||
description: Invalid username supplied
|
|
||||||
put:
|
|
||||||
tags:
|
|
||||||
- user
|
|
||||||
summary: Updated user
|
|
||||||
description: This can only be done by the logged in user.
|
|
||||||
operationId: updateUser
|
|
||||||
produces:
|
|
||||||
- application/json
|
|
||||||
- application/xml
|
|
||||||
parameters:
|
|
||||||
- in: path
|
|
||||||
name: username
|
|
||||||
description: name that need to be deleted
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
- in: body
|
|
||||||
name: body
|
|
||||||
description: Updated user object
|
|
||||||
required: false
|
|
||||||
schema:
|
|
||||||
$ref: "#/definitions/User"
|
|
||||||
responses:
|
|
||||||
"404":
|
|
||||||
description: User not found
|
|
||||||
"400":
|
|
||||||
description: Invalid user supplied
|
|
||||||
delete:
|
|
||||||
tags:
|
|
||||||
- user
|
|
||||||
summary: Delete user
|
|
||||||
description: This can only be done by the logged in user.
|
|
||||||
operationId: deleteUser
|
|
||||||
produces:
|
|
||||||
- application/json
|
|
||||||
- application/xml
|
|
||||||
parameters:
|
|
||||||
- in: path
|
|
||||||
name: username
|
|
||||||
description: The name that needs to be deleted
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
responses:
|
|
||||||
"404":
|
|
||||||
description: User not found
|
|
||||||
"400":
|
|
||||||
description: Invalid username supplied
|
|
||||||
securityDefinitions:
|
|
||||||
api_key:
|
|
||||||
type: apiKey
|
|
||||||
name: api_key
|
|
||||||
in: header
|
|
||||||
petstore_auth:
|
|
||||||
type: oauth2
|
|
||||||
authorizationUrl: http://petstore.swagger.io/api/oauth/dialog
|
|
||||||
flow: implicit
|
|
||||||
scopes:
|
|
||||||
write_pets: modify pets in your account
|
|
||||||
read_pets: read your pets
|
|
||||||
definitions:
|
|
||||||
User:
|
|
||||||
type: object
|
|
||||||
properties:
|
|
||||||
id:
|
|
||||||
type: integer
|
|
||||||
format: int64
|
|
||||||
username:
|
|
||||||
type: string
|
|
||||||
firstName:
|
|
||||||
type: string
|
|
||||||
lastName:
|
|
||||||
type: string
|
|
||||||
email:
|
|
||||||
type: string
|
|
||||||
password:
|
|
||||||
type: string
|
|
||||||
phone:
|
|
||||||
type: string
|
|
||||||
userStatus:
|
|
||||||
type: integer
|
|
||||||
format: int32
|
|
||||||
description: User Status
|
|
||||||
Category:
|
|
||||||
type: object
|
|
||||||
properties:
|
|
||||||
id:
|
|
||||||
type: integer
|
|
||||||
format: int64
|
|
||||||
name:
|
|
||||||
type: string
|
|
||||||
Pet:
|
|
||||||
type: object
|
|
||||||
required:
|
|
||||||
- name
|
|
||||||
- photoUrls
|
|
||||||
properties:
|
|
||||||
id:
|
|
||||||
type: integer
|
|
||||||
format: int64
|
|
||||||
category:
|
|
||||||
$ref: "#/definitions/Category"
|
|
||||||
name:
|
|
||||||
type: string
|
|
||||||
example: doggie
|
|
||||||
photoUrls:
|
|
||||||
type: array
|
|
||||||
items:
|
|
||||||
type: string
|
|
||||||
tags:
|
|
||||||
type: array
|
|
||||||
items:
|
|
||||||
$ref: "#/definitions/Tag"
|
|
||||||
status:
|
|
||||||
type: string
|
|
||||||
description: pet status in the store
|
|
||||||
Tag:
|
|
||||||
type: object
|
|
||||||
properties:
|
|
||||||
id:
|
|
||||||
type: integer
|
|
||||||
format: int64
|
|
||||||
name:
|
|
||||||
type: string
|
|
||||||
Order:
|
|
||||||
type: object
|
|
||||||
properties:
|
|
||||||
id:
|
|
||||||
type: integer
|
|
||||||
format: int64
|
|
||||||
petId:
|
|
||||||
type: integer
|
|
||||||
format: int64
|
|
||||||
quantity:
|
|
||||||
type: integer
|
|
||||||
format: int32
|
|
||||||
shipDate:
|
|
||||||
type: string
|
|
||||||
format: date-time
|
|
||||||
status:
|
|
||||||
type: string
|
|
||||||
description: Order Status
|
|
||||||
complete:
|
|
||||||
type: boolean
|
|
@ -1,23 +1,31 @@
|
|||||||
package io.swagger.api;
|
package io.swagger.api;
|
||||||
|
|
||||||
import io.swagger.model.Pet;
|
import io.swagger.model.Pet;
|
||||||
|
import io.swagger.model.InlineResponse200;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
import javax.ws.rs.*;
|
import javax.ws.rs.*;
|
||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
|
|
||||||
|
import org.apache.cxf.jaxrs.ext.multipart.*;
|
||||||
|
|
||||||
@Path("/")
|
@Path("/")
|
||||||
public interface PetApi {
|
public interface PetApi {
|
||||||
@PUT
|
|
||||||
@Path("/pet")
|
|
||||||
@Consumes({ "application/json", "application/xml" })
|
|
||||||
@Produces({ "application/json", "application/xml" })
|
|
||||||
public Response updatePet(Pet body);
|
|
||||||
@POST
|
@POST
|
||||||
@Path("/pet")
|
@Path("/pet")
|
||||||
@Consumes({ "application/json", "application/xml" })
|
@Consumes({ "application/json", "application/xml" })
|
||||||
@Produces({ "application/json", "application/xml" })
|
@Produces({ "application/json", "application/xml" })
|
||||||
public Response addPet(Pet body);
|
public Response addPet(Pet body);
|
||||||
|
@POST
|
||||||
|
@Path("/pet?testing_byte_array=true")
|
||||||
|
@Consumes({ "application/json", "application/xml" })
|
||||||
|
@Produces({ "application/json", "application/xml" })
|
||||||
|
public Response addPetUsingByteArray(byte[] body);
|
||||||
|
@DELETE
|
||||||
|
@Path("/pet/{petId}")
|
||||||
|
|
||||||
|
@Produces({ "application/json", "application/xml" })
|
||||||
|
public Response deletePet(@PathParam("petId") Long petId,@HeaderParam("api_key") String apiKey);
|
||||||
@GET
|
@GET
|
||||||
@Path("/pet/findByStatus")
|
@Path("/pet/findByStatus")
|
||||||
|
|
||||||
@ -33,31 +41,31 @@ public interface PetApi {
|
|||||||
|
|
||||||
@Produces({ "application/json", "application/xml" })
|
@Produces({ "application/json", "application/xml" })
|
||||||
public Response getPetById(@PathParam("petId") Long petId);
|
public Response getPetById(@PathParam("petId") Long petId);
|
||||||
|
@GET
|
||||||
|
@Path("/pet/{petId}?response=inline_arbitrary_object")
|
||||||
|
|
||||||
|
@Produces({ "application/json", "application/xml" })
|
||||||
|
public Response getPetByIdInObject(@PathParam("petId") Long petId);
|
||||||
|
@GET
|
||||||
|
@Path("/pet/{petId}?testing_byte_array=true")
|
||||||
|
|
||||||
|
@Produces({ "application/json", "application/xml" })
|
||||||
|
public Response petPetIdtestingByteArraytrueGet(@PathParam("petId") Long petId);
|
||||||
|
@PUT
|
||||||
|
@Path("/pet")
|
||||||
|
@Consumes({ "application/json", "application/xml" })
|
||||||
|
@Produces({ "application/json", "application/xml" })
|
||||||
|
public Response updatePet(Pet body);
|
||||||
@POST
|
@POST
|
||||||
@Path("/pet/{petId}")
|
@Path("/pet/{petId}")
|
||||||
@Consumes({ "application/x-www-form-urlencoded" })
|
@Consumes({ "application/x-www-form-urlencoded" })
|
||||||
@Produces({ "application/json", "application/xml" })
|
@Produces({ "application/json", "application/xml" })
|
||||||
public Response updatePetWithForm(@PathParam("petId") String petId,@Multipart(value = "name", required = false) String name,@Multipart(value = "status", required = false) String status);
|
public Response updatePetWithForm(@PathParam("petId") String petId,@Multipart(value = "name", required = false) String name,@Multipart(value = "status", required = false) String status);
|
||||||
@DELETE
|
|
||||||
@Path("/pet/{petId}")
|
|
||||||
|
|
||||||
@Produces({ "application/json", "application/xml" })
|
|
||||||
public Response deletePet(@PathParam("petId") Long petId,@HeaderParam("api_key") String apiKey);
|
|
||||||
@POST
|
@POST
|
||||||
@Path("/pet/{petId}/uploadImage")
|
@Path("/pet/{petId}/uploadImage")
|
||||||
@Consumes({ "multipart/form-data" })
|
@Consumes({ "multipart/form-data" })
|
||||||
@Produces({ "application/json", "application/xml" })
|
@Produces({ "application/json", "application/xml" })
|
||||||
public Response uploadFile(@PathParam("petId") Long petId,@Multipart(value = "additionalMetadata", required = false) String additionalMetadata, @Multipart(value = "file", required = false) InputStream fileInputStream,
|
public Response uploadFile(@PathParam("petId") Long petId,@Multipart(value = "additionalMetadata", required = false) String additionalMetadata, @Multipart(value = "file", required = false) InputStream fileInputStream,
|
||||||
@Multipart(value = "file" , required = false) Attachment fileDetail);
|
@Multipart(value = "file" , required = false) Attachment fileDetail);
|
||||||
@GET
|
|
||||||
@Path("/pet/{petId}?testing_byte_array=true")
|
|
||||||
|
|
||||||
@Produces({ "application/json", "application/xml" })
|
|
||||||
public Response petPetIdtestingByteArraytrueGet(@PathParam("petId") Long petId);
|
|
||||||
@POST
|
|
||||||
@Path("/pet?testing_byte_array=true")
|
|
||||||
@Consumes({ "application/json", "application/xml" })
|
|
||||||
@Produces({ "application/json", "application/xml" })
|
|
||||||
public Response addPetUsingByteArray(byte[] body);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,32 +1,44 @@
|
|||||||
package io.swagger.api;
|
package io.swagger.api;
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
import io.swagger.model.Order;
|
import io.swagger.model.Order;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.ws.rs.*;
|
import javax.ws.rs.*;
|
||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
|
|
||||||
|
import org.apache.cxf.jaxrs.ext.multipart.*;
|
||||||
|
|
||||||
@Path("/")
|
@Path("/")
|
||||||
public interface StoreApi {
|
public interface StoreApi {
|
||||||
@GET
|
|
||||||
@Path("/store/inventory")
|
|
||||||
|
|
||||||
@Produces({ "application/json", "application/xml" })
|
|
||||||
public Response getInventory();
|
|
||||||
@POST
|
|
||||||
@Path("/store/order")
|
|
||||||
|
|
||||||
@Produces({ "application/json", "application/xml" })
|
|
||||||
public Response placeOrder(Order body);
|
|
||||||
@GET
|
|
||||||
@Path("/store/order/{orderId}")
|
|
||||||
|
|
||||||
@Produces({ "application/json", "application/xml" })
|
|
||||||
public Response getOrderById(@PathParam("orderId") String orderId);
|
|
||||||
@DELETE
|
@DELETE
|
||||||
@Path("/store/order/{orderId}")
|
@Path("/store/order/{orderId}")
|
||||||
|
|
||||||
@Produces({ "application/json", "application/xml" })
|
@Produces({ "application/json", "application/xml" })
|
||||||
public Response deleteOrder(@PathParam("orderId") String orderId);
|
public Response deleteOrder(@PathParam("orderId") String orderId);
|
||||||
|
@GET
|
||||||
|
@Path("/store/findByStatus")
|
||||||
|
|
||||||
|
@Produces({ "application/json", "application/xml" })
|
||||||
|
public Response findOrdersByStatus(@QueryParam("status") String status);
|
||||||
|
@GET
|
||||||
|
@Path("/store/inventory")
|
||||||
|
|
||||||
|
@Produces({ "application/json", "application/xml" })
|
||||||
|
public Response getInventory();
|
||||||
|
@GET
|
||||||
|
@Path("/store/inventory?response=arbitrary_object")
|
||||||
|
|
||||||
|
@Produces({ "application/json", "application/xml" })
|
||||||
|
public Response getInventoryInObject();
|
||||||
|
@GET
|
||||||
|
@Path("/store/order/{orderId}")
|
||||||
|
|
||||||
|
@Produces({ "application/json", "application/xml" })
|
||||||
|
public Response getOrderById(@PathParam("orderId") String orderId);
|
||||||
|
@POST
|
||||||
|
@Path("/store/order")
|
||||||
|
|
||||||
|
@Produces({ "application/json", "application/xml" })
|
||||||
|
public Response placeOrder(Order body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,6 +6,8 @@ import java.util.List;
|
|||||||
import javax.ws.rs.*;
|
import javax.ws.rs.*;
|
||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
|
|
||||||
|
import org.apache.cxf.jaxrs.ext.multipart.*;
|
||||||
|
|
||||||
@Path("/")
|
@Path("/")
|
||||||
public interface UserApi {
|
public interface UserApi {
|
||||||
@POST
|
@POST
|
||||||
@ -23,6 +25,16 @@ public interface UserApi {
|
|||||||
|
|
||||||
@Produces({ "application/json", "application/xml" })
|
@Produces({ "application/json", "application/xml" })
|
||||||
public Response createUsersWithListInput(List<User> body);
|
public Response createUsersWithListInput(List<User> body);
|
||||||
|
@DELETE
|
||||||
|
@Path("/user/{username}")
|
||||||
|
|
||||||
|
@Produces({ "application/json", "application/xml" })
|
||||||
|
public Response deleteUser(@PathParam("username") String username);
|
||||||
|
@GET
|
||||||
|
@Path("/user/{username}")
|
||||||
|
|
||||||
|
@Produces({ "application/json", "application/xml" })
|
||||||
|
public Response getUserByName(@PathParam("username") String username);
|
||||||
@GET
|
@GET
|
||||||
@Path("/user/login")
|
@Path("/user/login")
|
||||||
|
|
||||||
@ -33,20 +45,10 @@ public interface UserApi {
|
|||||||
|
|
||||||
@Produces({ "application/json", "application/xml" })
|
@Produces({ "application/json", "application/xml" })
|
||||||
public Response logoutUser();
|
public Response logoutUser();
|
||||||
@GET
|
|
||||||
@Path("/user/{username}")
|
|
||||||
|
|
||||||
@Produces({ "application/json", "application/xml" })
|
|
||||||
public Response getUserByName(@PathParam("username") String username);
|
|
||||||
@PUT
|
@PUT
|
||||||
@Path("/user/{username}")
|
@Path("/user/{username}")
|
||||||
|
|
||||||
@Produces({ "application/json", "application/xml" })
|
@Produces({ "application/json", "application/xml" })
|
||||||
public Response updateUser(@PathParam("username") String username,User body);
|
public Response updateUser(@PathParam("username") String username,User body);
|
||||||
@DELETE
|
|
||||||
@Path("/user/{username}")
|
|
||||||
|
|
||||||
@Produces({ "application/json", "application/xml" })
|
|
||||||
public Response deleteUser(@PathParam("username") String username);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,7 +168,7 @@
|
|||||||
</repository>
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
<properties>
|
<properties>
|
||||||
<swagger-core-version>1.5.7</swagger-core-version>
|
<swagger-core-version>1.5.8</swagger-core-version>
|
||||||
<jetty-version>9.2.9.v20150224</jetty-version>
|
<jetty-version>9.2.9.v20150224</jetty-version>
|
||||||
<jersey-version>1.18.1</jersey-version>
|
<jersey-version>1.18.1</jersey-version>
|
||||||
<slf4j-version>1.6.3</slf4j-version>
|
<slf4j-version>1.6.3</slf4j-version>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package io.swagger.api;
|
package io.swagger.api;
|
||||||
|
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2016-01-31T21:10:14.319Z")
|
|
||||||
public class ApiException extends Exception{
|
public class ApiException extends Exception{
|
||||||
private int code;
|
private int code;
|
||||||
public ApiException (int code, String msg) {
|
public ApiException (int code, String msg) {
|
||||||
|
@ -5,7 +5,7 @@ import java.io.IOException;
|
|||||||
import javax.servlet.*;
|
import javax.servlet.*;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2016-01-31T21:10:14.319Z")
|
|
||||||
public class ApiOriginFilter implements javax.servlet.Filter {
|
public class ApiOriginFilter implements javax.servlet.Filter {
|
||||||
public void doFilter(ServletRequest request, ServletResponse response,
|
public void doFilter(ServletRequest request, ServletResponse response,
|
||||||
FilterChain chain) throws IOException, ServletException {
|
FilterChain chain) throws IOException, ServletException {
|
||||||
|
@ -3,7 +3,7 @@ package io.swagger.api;
|
|||||||
import javax.xml.bind.annotation.XmlTransient;
|
import javax.xml.bind.annotation.XmlTransient;
|
||||||
|
|
||||||
@javax.xml.bind.annotation.XmlRootElement
|
@javax.xml.bind.annotation.XmlRootElement
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2016-01-31T21:10:14.319Z")
|
|
||||||
public class ApiResponseMessage {
|
public class ApiResponseMessage {
|
||||||
public static final int ERROR = 1;
|
public static final int ERROR = 1;
|
||||||
public static final int WARNING = 2;
|
public static final int WARNING = 2;
|
||||||
|
@ -0,0 +1,19 @@
|
|||||||
|
package io.swagger.api;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider;
|
||||||
|
import io.swagger.util.Json;
|
||||||
|
|
||||||
|
import javax.ws.rs.Produces;
|
||||||
|
import javax.ws.rs.core.MediaType;
|
||||||
|
import javax.ws.rs.ext.Provider;
|
||||||
|
|
||||||
|
@Provider
|
||||||
|
@Produces({MediaType.APPLICATION_JSON})
|
||||||
|
public class JacksonJsonProvider extends JacksonJaxbJsonProvider {
|
||||||
|
private static ObjectMapper commonMapper = Json.mapper();
|
||||||
|
|
||||||
|
public JacksonJsonProvider() {
|
||||||
|
super.setMapper(commonMapper);
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
package io.swagger.api;
|
package io.swagger.api;
|
||||||
|
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2016-01-31T21:10:14.319Z")
|
|
||||||
public class NotFoundException extends ApiException {
|
public class NotFoundException extends ApiException {
|
||||||
private int code;
|
private int code;
|
||||||
public NotFoundException (int code, String msg) {
|
public NotFoundException (int code, String msg) {
|
||||||
|
@ -9,6 +9,7 @@ import io.swagger.annotations.ApiParam;
|
|||||||
import com.sun.jersey.multipart.FormDataParam;
|
import com.sun.jersey.multipart.FormDataParam;
|
||||||
|
|
||||||
import io.swagger.model.Pet;
|
import io.swagger.model.Pet;
|
||||||
|
import io.swagger.model.ApiResponse;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -28,36 +29,14 @@ import javax.ws.rs.*;
|
|||||||
|
|
||||||
|
|
||||||
@io.swagger.annotations.Api(description = "the pet API")
|
@io.swagger.annotations.Api(description = "the pet API")
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2016-01-31T21:10:14.319Z")
|
|
||||||
public class PetApi {
|
public class PetApi {
|
||||||
private final PetApiService delegate = PetApiServiceFactory.getPetApi();
|
private final PetApiService delegate = PetApiServiceFactory.getPetApi();
|
||||||
|
|
||||||
@PUT
|
|
||||||
|
|
||||||
@Consumes({ "application/json", "application/xml" })
|
|
||||||
@Produces({ "application/json", "application/xml" })
|
|
||||||
@io.swagger.annotations.ApiOperation(value = "Update an existing pet", notes = "", response = void.class, authorizations = {
|
|
||||||
@io.swagger.annotations.Authorization(value = "petstore_auth", scopes = {
|
|
||||||
@io.swagger.annotations.AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
|
||||||
@io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets")
|
|
||||||
})
|
|
||||||
}, tags={ "pet", })
|
|
||||||
@io.swagger.annotations.ApiResponses(value = {
|
|
||||||
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = void.class),
|
|
||||||
|
|
||||||
@io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found", response = void.class),
|
|
||||||
|
|
||||||
@io.swagger.annotations.ApiResponse(code = 405, message = "Validation exception", response = void.class) })
|
|
||||||
|
|
||||||
public Response updatePet(
|
|
||||||
@ApiParam(value = "Pet object that needs to be added to the store" ) Pet body,@Context SecurityContext securityContext)
|
|
||||||
throws NotFoundException {
|
|
||||||
return delegate.updatePet(body,securityContext);
|
|
||||||
}
|
|
||||||
@POST
|
@POST
|
||||||
|
|
||||||
@Consumes({ "application/json", "application/xml" })
|
@Consumes({ "application/json", "application/xml" })
|
||||||
@Produces({ "application/json", "application/xml" })
|
@Produces({ "application/xml", "application/json" })
|
||||||
@io.swagger.annotations.ApiOperation(value = "Add a new pet to the store", notes = "", response = void.class, authorizations = {
|
@io.swagger.annotations.ApiOperation(value = "Add a new pet to the store", notes = "", response = void.class, authorizations = {
|
||||||
@io.swagger.annotations.Authorization(value = "petstore_auth", scopes = {
|
@io.swagger.annotations.Authorization(value = "petstore_auth", scopes = {
|
||||||
@io.swagger.annotations.AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
@io.swagger.annotations.AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
||||||
@ -66,95 +45,16 @@ public class PetApi {
|
|||||||
}, tags={ "pet", })
|
}, tags={ "pet", })
|
||||||
@io.swagger.annotations.ApiResponses(value = {
|
@io.swagger.annotations.ApiResponses(value = {
|
||||||
@io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = void.class) })
|
@io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = void.class) })
|
||||||
|
|
||||||
public Response addPet(
|
public Response addPet(
|
||||||
@ApiParam(value = "Pet object that needs to be added to the store" ) Pet body,@Context SecurityContext securityContext)
|
@ApiParam(value = "Pet object that needs to be added to the store" ,required=true) Pet body,
|
||||||
|
@Context SecurityContext securityContext)
|
||||||
throws NotFoundException {
|
throws NotFoundException {
|
||||||
return delegate.addPet(body,securityContext);
|
return delegate.addPet(body,securityContext);
|
||||||
}
|
}
|
||||||
@GET
|
|
||||||
@Path("/findByStatus")
|
|
||||||
|
|
||||||
@Produces({ "application/json", "application/xml" })
|
|
||||||
@io.swagger.annotations.ApiOperation(value = "Finds Pets by status", notes = "Multiple status values can be provided with comma seperated strings", response = Pet.class, responseContainer = "List", authorizations = {
|
|
||||||
@io.swagger.annotations.Authorization(value = "petstore_auth", scopes = {
|
|
||||||
@io.swagger.annotations.AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
|
||||||
@io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets")
|
|
||||||
})
|
|
||||||
}, tags={ "pet", })
|
|
||||||
@io.swagger.annotations.ApiResponses(value = {
|
|
||||||
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"),
|
|
||||||
|
|
||||||
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid status value", response = Pet.class, responseContainer = "List") })
|
|
||||||
|
|
||||||
public Response findPetsByStatus(@ApiParam(value = "Status values that need to be considered for filter", defaultValue="available") @DefaultValue("available") @QueryParam("status") List<String> status
|
|
||||||
,@Context SecurityContext securityContext)
|
|
||||||
throws NotFoundException {
|
|
||||||
return delegate.findPetsByStatus(status,securityContext);
|
|
||||||
}
|
|
||||||
@GET
|
|
||||||
@Path("/findByTags")
|
|
||||||
|
|
||||||
@Produces({ "application/json", "application/xml" })
|
|
||||||
@io.swagger.annotations.ApiOperation(value = "Finds Pets by tags", notes = "Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.", response = Pet.class, responseContainer = "List", authorizations = {
|
|
||||||
@io.swagger.annotations.Authorization(value = "petstore_auth", scopes = {
|
|
||||||
@io.swagger.annotations.AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
|
||||||
@io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets")
|
|
||||||
})
|
|
||||||
}, tags={ "pet", })
|
|
||||||
@io.swagger.annotations.ApiResponses(value = {
|
|
||||||
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"),
|
|
||||||
|
|
||||||
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid tag value", response = Pet.class, responseContainer = "List") })
|
|
||||||
|
|
||||||
public Response findPetsByTags(@ApiParam(value = "Tags to filter by") @QueryParam("tags") List<String> tags
|
|
||||||
,@Context SecurityContext securityContext)
|
|
||||||
throws NotFoundException {
|
|
||||||
return delegate.findPetsByTags(tags,securityContext);
|
|
||||||
}
|
|
||||||
@GET
|
|
||||||
@Path("/{petId}")
|
|
||||||
|
|
||||||
@Produces({ "application/json", "application/xml" })
|
|
||||||
@io.swagger.annotations.ApiOperation(value = "Find pet by ID", notes = "Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions", response = Pet.class, authorizations = {
|
|
||||||
@io.swagger.annotations.Authorization(value = "api_key")
|
|
||||||
}, tags={ "pet", })
|
|
||||||
@io.swagger.annotations.ApiResponses(value = {
|
|
||||||
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class),
|
|
||||||
|
|
||||||
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = Pet.class),
|
|
||||||
|
|
||||||
@io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found", response = Pet.class) })
|
|
||||||
|
|
||||||
public Response getPetById(
|
|
||||||
@ApiParam(value = "ID of pet that needs to be fetched",required=true) @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" })
|
|
||||||
@io.swagger.annotations.ApiOperation(value = "Updates a pet in the store with form data", notes = "", response = void.class, authorizations = {
|
|
||||||
@io.swagger.annotations.Authorization(value = "petstore_auth", scopes = {
|
|
||||||
@io.swagger.annotations.AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
|
||||||
@io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets")
|
|
||||||
})
|
|
||||||
}, tags={ "pet", })
|
|
||||||
@io.swagger.annotations.ApiResponses(value = {
|
|
||||||
@io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = void.class) })
|
|
||||||
|
|
||||||
public Response updatePetWithForm(
|
|
||||||
@ApiParam(value = "ID of pet that needs to be updated",required=true) @PathParam("petId") String petId,
|
|
||||||
@ApiParam(value = "Updated name of the pet")@FormParam("name") String name,
|
|
||||||
@ApiParam(value = "Updated status of the pet")@FormParam("status") String status,@Context SecurityContext securityContext)
|
|
||||||
throws NotFoundException {
|
|
||||||
return delegate.updatePetWithForm(petId,name,status,securityContext);
|
|
||||||
}
|
|
||||||
@DELETE
|
@DELETE
|
||||||
@Path("/{petId}")
|
@Path("/{petId}")
|
||||||
|
|
||||||
@Produces({ "application/json", "application/xml" })
|
@Produces({ "application/xml", "application/json" })
|
||||||
@io.swagger.annotations.ApiOperation(value = "Deletes a pet", notes = "", response = void.class, authorizations = {
|
@io.swagger.annotations.ApiOperation(value = "Deletes a pet", notes = "", response = void.class, authorizations = {
|
||||||
@io.swagger.annotations.Authorization(value = "petstore_auth", scopes = {
|
@io.swagger.annotations.Authorization(value = "petstore_auth", scopes = {
|
||||||
@io.swagger.annotations.AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
@io.swagger.annotations.AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
||||||
@ -162,52 +62,129 @@ public class PetApi {
|
|||||||
})
|
})
|
||||||
}, tags={ "pet", })
|
}, tags={ "pet", })
|
||||||
@io.swagger.annotations.ApiResponses(value = {
|
@io.swagger.annotations.ApiResponses(value = {
|
||||||
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid pet value", response = void.class) })
|
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = void.class),
|
||||||
|
@io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found", response = void.class) })
|
||||||
public Response deletePet(
|
public Response deletePet(
|
||||||
@ApiParam(value = "Pet id to delete",required=true) @PathParam("petId") Long petId,
|
@ApiParam(value = "Pet id to delete",required=true) @PathParam("petId") Long petId,
|
||||||
@ApiParam(value = "" )@HeaderParam("api_key") String apiKey,@Context SecurityContext securityContext)
|
@ApiParam(value = "" )@HeaderParam("api_key") String apiKey,
|
||||||
|
@Context SecurityContext securityContext)
|
||||||
throws NotFoundException {
|
throws NotFoundException {
|
||||||
return delegate.deletePet(petId,apiKey,securityContext);
|
return delegate.deletePet(petId,apiKey,securityContext);
|
||||||
}
|
}
|
||||||
@POST
|
@GET
|
||||||
@Path("/{petId}/uploadImage")
|
@Path("/findByStatus")
|
||||||
@Consumes({ "multipart/form-data" })
|
|
||||||
@Produces({ "application/json", "application/xml" })
|
@Produces({ "application/xml", "application/json" })
|
||||||
@io.swagger.annotations.ApiOperation(value = "uploads an image", notes = "", response = void.class, authorizations = {
|
@io.swagger.annotations.ApiOperation(value = "Finds Pets by status", notes = "Multiple status values can be provided with comma separated strings", response = Pet.class, responseContainer = "List", authorizations = {
|
||||||
@io.swagger.annotations.Authorization(value = "petstore_auth", scopes = {
|
@io.swagger.annotations.Authorization(value = "petstore_auth", scopes = {
|
||||||
@io.swagger.annotations.AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
@io.swagger.annotations.AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
||||||
@io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets")
|
@io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets")
|
||||||
})
|
})
|
||||||
}, tags={ "pet", })
|
}, tags={ "pet", })
|
||||||
@io.swagger.annotations.ApiResponses(value = {
|
@io.swagger.annotations.ApiResponses(value = {
|
||||||
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = void.class) })
|
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"),
|
||||||
|
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid status value", response = Pet.class, responseContainer = "List") })
|
||||||
|
public Response findPetsByStatus(
|
||||||
|
@ApiParam(value = "Status values that need to be considered for filter",required=true) @QueryParam("status") List<String> status,
|
||||||
|
@Context SecurityContext securityContext)
|
||||||
|
throws NotFoundException {
|
||||||
|
return delegate.findPetsByStatus(status,securityContext);
|
||||||
|
}
|
||||||
|
@GET
|
||||||
|
@Path("/findByTags")
|
||||||
|
|
||||||
|
@Produces({ "application/xml", "application/json" })
|
||||||
|
@io.swagger.annotations.ApiOperation(value = "Finds Pets by tags", notes = "Muliple tags can be provided with comma separated strings. Use\ntag1, tag2, tag3 for testing.\n", response = Pet.class, responseContainer = "List", authorizations = {
|
||||||
|
@io.swagger.annotations.Authorization(value = "petstore_auth", scopes = {
|
||||||
|
@io.swagger.annotations.AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
||||||
|
@io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets")
|
||||||
|
})
|
||||||
|
}, tags={ "pet", })
|
||||||
|
@io.swagger.annotations.ApiResponses(value = {
|
||||||
|
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"),
|
||||||
|
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid tag value", response = Pet.class, responseContainer = "List") })
|
||||||
|
public Response findPetsByTags(
|
||||||
|
@ApiParam(value = "Tags to filter by",required=true) @QueryParam("tags") List<String> tags,
|
||||||
|
@Context SecurityContext securityContext)
|
||||||
|
throws NotFoundException {
|
||||||
|
return delegate.findPetsByTags(tags,securityContext);
|
||||||
|
}
|
||||||
|
@GET
|
||||||
|
@Path("/{petId}")
|
||||||
|
|
||||||
|
@Produces({ "application/xml", "application/json" })
|
||||||
|
@io.swagger.annotations.ApiOperation(value = "Find pet by ID", notes = "Returns a single pet", response = Pet.class, authorizations = {
|
||||||
|
@io.swagger.annotations.Authorization(value = "api_key")
|
||||||
|
}, tags={ "pet", })
|
||||||
|
@io.swagger.annotations.ApiResponses(value = {
|
||||||
|
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class),
|
||||||
|
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = Pet.class),
|
||||||
|
@io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found", response = Pet.class) })
|
||||||
|
public Response getPetById(
|
||||||
|
@ApiParam(value = "ID of pet to return",required=true) @PathParam("petId") Long petId,
|
||||||
|
@Context SecurityContext securityContext)
|
||||||
|
throws NotFoundException {
|
||||||
|
return delegate.getPetById(petId,securityContext);
|
||||||
|
}
|
||||||
|
@PUT
|
||||||
|
|
||||||
|
@Consumes({ "application/json", "application/xml" })
|
||||||
|
@Produces({ "application/xml", "application/json" })
|
||||||
|
@io.swagger.annotations.ApiOperation(value = "Update an existing pet", notes = "", response = void.class, authorizations = {
|
||||||
|
@io.swagger.annotations.Authorization(value = "petstore_auth", scopes = {
|
||||||
|
@io.swagger.annotations.AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
||||||
|
@io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets")
|
||||||
|
})
|
||||||
|
}, tags={ "pet", })
|
||||||
|
@io.swagger.annotations.ApiResponses(value = {
|
||||||
|
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = void.class),
|
||||||
|
@io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found", response = void.class),
|
||||||
|
@io.swagger.annotations.ApiResponse(code = 405, message = "Validation exception", response = void.class) })
|
||||||
|
public Response updatePet(
|
||||||
|
@ApiParam(value = "Pet object that needs to be added to the store" ,required=true) Pet body,
|
||||||
|
@Context SecurityContext securityContext)
|
||||||
|
throws NotFoundException {
|
||||||
|
return delegate.updatePet(body,securityContext);
|
||||||
|
}
|
||||||
|
@POST
|
||||||
|
@Path("/{petId}")
|
||||||
|
@Consumes({ "application/x-www-form-urlencoded" })
|
||||||
|
@Produces({ "application/xml", "application/json" })
|
||||||
|
@io.swagger.annotations.ApiOperation(value = "Updates a pet in the store with form data", notes = "null", response = void.class, authorizations = {
|
||||||
|
@io.swagger.annotations.Authorization(value = "petstore_auth", scopes = {
|
||||||
|
@io.swagger.annotations.AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
||||||
|
@io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets")
|
||||||
|
})
|
||||||
|
}, tags={ "pet", })
|
||||||
|
@io.swagger.annotations.ApiResponses(value = {
|
||||||
|
@io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = void.class) })
|
||||||
|
public Response updatePetWithForm(
|
||||||
|
@ApiParam(value = "ID of pet that needs to be updated",required=true) @PathParam("petId") Long petId,
|
||||||
|
@ApiParam(value = "Updated name of the pet")@FormParam("name") String name,
|
||||||
|
@ApiParam(value = "Updated status of the pet")@FormParam("status") String status,
|
||||||
|
@Context SecurityContext securityContext)
|
||||||
|
throws NotFoundException {
|
||||||
|
return delegate.updatePetWithForm(petId,name,status,securityContext);
|
||||||
|
}
|
||||||
|
@POST
|
||||||
|
@Path("/{petId}/uploadImage")
|
||||||
|
@Consumes({ "multipart/form-data" })
|
||||||
|
@Produces({ "application/json" })
|
||||||
|
@io.swagger.annotations.ApiOperation(value = "uploads an image", notes = "", response = ApiResponse.class, authorizations = {
|
||||||
|
@io.swagger.annotations.Authorization(value = "petstore_auth", scopes = {
|
||||||
|
@io.swagger.annotations.AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
||||||
|
@io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets")
|
||||||
|
})
|
||||||
|
}, tags={ "pet" })
|
||||||
|
@io.swagger.annotations.ApiResponses(value = {
|
||||||
|
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = ApiResponse.class) })
|
||||||
public Response uploadFile(
|
public Response uploadFile(
|
||||||
@ApiParam(value = "ID of pet to update",required=true) @PathParam("petId") Long petId,
|
@ApiParam(value = "ID of pet to update",required=true) @PathParam("petId") Long petId,
|
||||||
@ApiParam(value = "Additional data to pass to server")@FormParam("additionalMetadata") String additionalMetadata,
|
@FormDataParam("additionalMetadata") String additionalMetadata,
|
||||||
@FormDataParam("file") InputStream inputStream,
|
@FormDataParam("file") InputStream inputStream,
|
||||||
@FormDataParam("file") FormDataContentDisposition fileDetail,@Context SecurityContext securityContext)
|
@FormDataParam("file") FormDataContentDisposition fileDetail,
|
||||||
|
@Context SecurityContext securityContext)
|
||||||
throws NotFoundException {
|
throws NotFoundException {
|
||||||
return delegate.uploadFile(petId,additionalMetadata,inputStream, fileDetail,securityContext);
|
return delegate.uploadFile(petId,additionalMetadata,inputStream, fileDetail,securityContext);
|
||||||
}
|
}
|
||||||
@GET
|
|
||||||
@Path("/{petId}?testing_byte_array=true")
|
|
||||||
|
|
||||||
@Produces({ "application/json", "application/xml" })
|
|
||||||
@io.swagger.annotations.ApiOperation(value = "Fake endpoint to test byte array return by 'Find pet by ID'", notes = "Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions", response = byte[].class, authorizations = {
|
|
||||||
@io.swagger.annotations.Authorization(value = "api_key")
|
|
||||||
}, tags={ "pet" })
|
|
||||||
@io.swagger.annotations.ApiResponses(value = {
|
|
||||||
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = byte[].class),
|
|
||||||
|
|
||||||
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = byte[].class),
|
|
||||||
|
|
||||||
@io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found", response = byte[].class) })
|
|
||||||
|
|
||||||
public Response getPetByIdWithByteArray(
|
|
||||||
@ApiParam(value = "ID of pet that needs to be fetched",required=true) @PathParam("petId") Long petId,@Context SecurityContext securityContext)
|
|
||||||
throws NotFoundException {
|
|
||||||
return delegate.getPetByIdWithByteArray(petId,securityContext);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ import io.swagger.model.*;
|
|||||||
import com.sun.jersey.multipart.FormDataParam;
|
import com.sun.jersey.multipart.FormDataParam;
|
||||||
|
|
||||||
import io.swagger.model.Pet;
|
import io.swagger.model.Pet;
|
||||||
|
import io.swagger.model.ApiResponse;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -19,13 +20,13 @@ import com.sun.jersey.multipart.FormDataParam;
|
|||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
import javax.ws.rs.core.SecurityContext;
|
import javax.ws.rs.core.SecurityContext;
|
||||||
|
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2016-01-31T21:10:14.319Z")
|
|
||||||
public abstract class PetApiService {
|
public abstract class PetApiService {
|
||||||
|
|
||||||
public abstract Response updatePet(Pet body,SecurityContext securityContext)
|
public abstract Response addPet(Pet body,SecurityContext securityContext)
|
||||||
throws NotFoundException;
|
throws NotFoundException;
|
||||||
|
|
||||||
public abstract Response addPet(Pet body,SecurityContext securityContext)
|
public abstract Response deletePet(Long petId,String apiKey,SecurityContext securityContext)
|
||||||
throws NotFoundException;
|
throws NotFoundException;
|
||||||
|
|
||||||
public abstract Response findPetsByStatus(List<String> status,SecurityContext securityContext)
|
public abstract Response findPetsByStatus(List<String> status,SecurityContext securityContext)
|
||||||
@ -37,16 +38,13 @@ public abstract class PetApiService {
|
|||||||
public abstract Response getPetById(Long petId,SecurityContext securityContext)
|
public abstract Response getPetById(Long petId,SecurityContext securityContext)
|
||||||
throws NotFoundException;
|
throws NotFoundException;
|
||||||
|
|
||||||
public abstract Response updatePetWithForm(String petId,String name,String status,SecurityContext securityContext)
|
public abstract Response updatePet(Pet body,SecurityContext securityContext)
|
||||||
throws NotFoundException;
|
throws NotFoundException;
|
||||||
|
|
||||||
public abstract Response deletePet(Long petId,String apiKey,SecurityContext securityContext)
|
public abstract Response updatePetWithForm(Long petId,String name,String status,SecurityContext securityContext)
|
||||||
throws NotFoundException;
|
throws NotFoundException;
|
||||||
|
|
||||||
public abstract Response uploadFile(Long petId,String additionalMetadata,InputStream inputStream, FormDataContentDisposition fileDetail,SecurityContext securityContext)
|
public abstract Response uploadFile(Long petId,String additionalMetadata,InputStream inputStream, FormDataContentDisposition fileDetail,SecurityContext securityContext)
|
||||||
throws NotFoundException;
|
throws NotFoundException;
|
||||||
|
|
||||||
public abstract Response getPetByIdWithByteArray(Long petId,SecurityContext securityContext)
|
|
||||||
throws NotFoundException;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,51 +0,0 @@
|
|||||||
package io.swagger.api;
|
|
||||||
|
|
||||||
import io.swagger.model.*;
|
|
||||||
import io.swagger.api.PettestingByteArraytrueApiService;
|
|
||||||
import io.swagger.api.factories.PettestingByteArraytrueApiServiceFactory;
|
|
||||||
|
|
||||||
import io.swagger.annotations.ApiParam;
|
|
||||||
|
|
||||||
import com.sun.jersey.multipart.FormDataParam;
|
|
||||||
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import io.swagger.api.NotFoundException;
|
|
||||||
|
|
||||||
import java.io.InputStream;
|
|
||||||
|
|
||||||
import com.sun.jersey.core.header.FormDataContentDisposition;
|
|
||||||
import com.sun.jersey.multipart.FormDataParam;
|
|
||||||
|
|
||||||
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")
|
|
||||||
|
|
||||||
|
|
||||||
@io.swagger.annotations.Api(description = "the pet?testing_byte_array=true API")
|
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2016-01-31T21:10:14.319Z")
|
|
||||||
public class PettestingByteArraytrueApi {
|
|
||||||
private final PettestingByteArraytrueApiService delegate = PettestingByteArraytrueApiServiceFactory.getPettestingByteArraytrueApi();
|
|
||||||
|
|
||||||
@POST
|
|
||||||
|
|
||||||
@Consumes({ "application/json", "application/xml" })
|
|
||||||
@Produces({ "application/json", "application/xml" })
|
|
||||||
@io.swagger.annotations.ApiOperation(value = "Fake endpoint to test byte array in body parameter for adding a new pet to the store", notes = "", response = void.class, authorizations = {
|
|
||||||
@io.swagger.annotations.Authorization(value = "petstore_auth", scopes = {
|
|
||||||
@io.swagger.annotations.AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
|
||||||
@io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets")
|
|
||||||
})
|
|
||||||
}, tags={ "pet" })
|
|
||||||
@io.swagger.annotations.ApiResponses(value = {
|
|
||||||
@io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = void.class) })
|
|
||||||
|
|
||||||
public Response addPetUsingByteArray(
|
|
||||||
@ApiParam(value = "Pet object in the form of byte array" ) byte[] body,@Context SecurityContext securityContext)
|
|
||||||
throws NotFoundException {
|
|
||||||
return delegate.addPetUsingByteArray(body,securityContext);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,26 +0,0 @@
|
|||||||
package io.swagger.api;
|
|
||||||
|
|
||||||
import io.swagger.api.*;
|
|
||||||
import io.swagger.model.*;
|
|
||||||
|
|
||||||
import com.sun.jersey.multipart.FormDataParam;
|
|
||||||
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import io.swagger.api.NotFoundException;
|
|
||||||
|
|
||||||
import java.io.InputStream;
|
|
||||||
|
|
||||||
import com.sun.jersey.core.header.FormDataContentDisposition;
|
|
||||||
import com.sun.jersey.multipart.FormDataParam;
|
|
||||||
|
|
||||||
import javax.ws.rs.core.Response;
|
|
||||||
import javax.ws.rs.core.SecurityContext;
|
|
||||||
|
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2016-01-31T21:10:14.319Z")
|
|
||||||
public abstract class PettestingByteArraytrueApiService {
|
|
||||||
|
|
||||||
public abstract Response addPetUsingByteArray(byte[] body,SecurityContext securityContext)
|
|
||||||
throws NotFoundException;
|
|
||||||
|
|
||||||
}
|
|
@ -28,69 +28,65 @@ import javax.ws.rs.*;
|
|||||||
|
|
||||||
|
|
||||||
@io.swagger.annotations.Api(description = "the store API")
|
@io.swagger.annotations.Api(description = "the store API")
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2016-01-31T21:10:14.319Z")
|
|
||||||
public class StoreApi {
|
public class StoreApi {
|
||||||
private final StoreApiService delegate = StoreApiServiceFactory.getStoreApi();
|
private final StoreApiService delegate = StoreApiServiceFactory.getStoreApi();
|
||||||
|
|
||||||
|
@DELETE
|
||||||
|
@Path("/order/{orderId}")
|
||||||
|
|
||||||
|
@Produces({ "application/xml", "application/json" })
|
||||||
|
@io.swagger.annotations.ApiOperation(value = "Delete purchase order by ID", notes = "For valid response try integer IDs with positive integer value.\\ \\ Negative or non-integer values will generate API errors", response = void.class, tags={ "store", })
|
||||||
|
@io.swagger.annotations.ApiResponses(value = {
|
||||||
|
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = void.class),
|
||||||
|
@io.swagger.annotations.ApiResponse(code = 404, message = "Order not found", response = void.class) })
|
||||||
|
public Response deleteOrder(
|
||||||
|
@ApiParam(value = "ID of the order that needs to be deleted",required=true) @PathParam("orderId") Long orderId,
|
||||||
|
@Context SecurityContext securityContext)
|
||||||
|
throws NotFoundException {
|
||||||
|
return delegate.deleteOrder(orderId,securityContext);
|
||||||
|
}
|
||||||
@GET
|
@GET
|
||||||
@Path("/inventory")
|
@Path("/inventory")
|
||||||
|
|
||||||
@Produces({ "application/json", "application/xml" })
|
@Produces({ "application/json" })
|
||||||
@io.swagger.annotations.ApiOperation(value = "Returns pet inventories by status", notes = "Returns a map of status codes to quantities", response = Integer.class, responseContainer = "Map", authorizations = {
|
@io.swagger.annotations.ApiOperation(value = "Returns pet inventories by status", notes = "Returns a map of status codes to quantities", response = Integer.class, responseContainer = "Map", authorizations = {
|
||||||
@io.swagger.annotations.Authorization(value = "api_key")
|
@io.swagger.annotations.Authorization(value = "api_key")
|
||||||
}, tags={ "store", })
|
}, tags={ "store", })
|
||||||
@io.swagger.annotations.ApiResponses(value = {
|
@io.swagger.annotations.ApiResponses(value = {
|
||||||
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Integer.class, responseContainer = "Map") })
|
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Integer.class, responseContainer = "Map") })
|
||||||
|
public Response getInventory(
|
||||||
public Response getInventory(@Context SecurityContext securityContext)
|
@Context SecurityContext securityContext)
|
||||||
throws NotFoundException {
|
throws NotFoundException {
|
||||||
return delegate.getInventory(securityContext);
|
return delegate.getInventory(securityContext);
|
||||||
}
|
}
|
||||||
@POST
|
|
||||||
@Path("/order")
|
|
||||||
|
|
||||||
@Produces({ "application/json", "application/xml" })
|
|
||||||
@io.swagger.annotations.ApiOperation(value = "Place an order for a pet", notes = "", response = Order.class, tags={ "store", })
|
|
||||||
@io.swagger.annotations.ApiResponses(value = {
|
|
||||||
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Order.class),
|
|
||||||
|
|
||||||
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid Order", response = Order.class) })
|
|
||||||
|
|
||||||
public Response placeOrder(
|
|
||||||
@ApiParam(value = "order placed for purchasing the pet" ) Order body,@Context SecurityContext securityContext)
|
|
||||||
throws NotFoundException {
|
|
||||||
return delegate.placeOrder(body,securityContext);
|
|
||||||
}
|
|
||||||
@GET
|
@GET
|
||||||
@Path("/order/{orderId}")
|
@Path("/order/{orderId}")
|
||||||
|
|
||||||
@Produces({ "application/json", "application/xml" })
|
@Produces({ "application/xml", "application/json" })
|
||||||
@io.swagger.annotations.ApiOperation(value = "Find purchase order by ID", notes = "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions", response = Order.class, tags={ "store", })
|
@io.swagger.annotations.ApiOperation(value = "Find purchase order by ID", notes = "For valid response try integer IDs with value >= 1 and <= 10.\nOther values will generated exceptions\n", response = Order.class, tags={ "store", })
|
||||||
@io.swagger.annotations.ApiResponses(value = {
|
@io.swagger.annotations.ApiResponses(value = {
|
||||||
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Order.class),
|
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Order.class),
|
||||||
|
|
||||||
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = Order.class),
|
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = Order.class),
|
||||||
|
|
||||||
@io.swagger.annotations.ApiResponse(code = 404, message = "Order not found", response = Order.class) })
|
@io.swagger.annotations.ApiResponse(code = 404, message = "Order not found", response = Order.class) })
|
||||||
|
|
||||||
public Response getOrderById(
|
public Response getOrderById(
|
||||||
@ApiParam(value = "ID of pet that needs to be fetched",required=true) @PathParam("orderId") String orderId,@Context SecurityContext securityContext)
|
@ApiParam(value = "ID of pet that needs to be fetched",required=true) @PathParam("orderId") Long orderId,
|
||||||
|
@Context SecurityContext securityContext)
|
||||||
throws NotFoundException {
|
throws NotFoundException {
|
||||||
return delegate.getOrderById(orderId,securityContext);
|
return delegate.getOrderById(orderId,securityContext);
|
||||||
}
|
}
|
||||||
@DELETE
|
@POST
|
||||||
@Path("/order/{orderId}")
|
@Path("/order")
|
||||||
|
|
||||||
@Produces({ "application/json", "application/xml" })
|
@Produces({ "application/xml", "application/json" })
|
||||||
@io.swagger.annotations.ApiOperation(value = "Delete purchase order by ID", notes = "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors", response = void.class, tags={ "store" })
|
@io.swagger.annotations.ApiOperation(value = "Place an order for a pet", notes = "", response = Order.class, tags={ "store" })
|
||||||
@io.swagger.annotations.ApiResponses(value = {
|
@io.swagger.annotations.ApiResponses(value = {
|
||||||
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = void.class),
|
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Order.class),
|
||||||
|
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid Order", response = Order.class) })
|
||||||
@io.swagger.annotations.ApiResponse(code = 404, message = "Order not found", response = void.class) })
|
public Response placeOrder(
|
||||||
|
@ApiParam(value = "order placed for purchasing the pet" ,required=true) Order body,
|
||||||
public Response deleteOrder(
|
@Context SecurityContext securityContext)
|
||||||
@ApiParam(value = "ID of the order that needs to be deleted",required=true) @PathParam("orderId") String orderId,@Context SecurityContext securityContext)
|
|
||||||
throws NotFoundException {
|
throws NotFoundException {
|
||||||
return delegate.deleteOrder(orderId,securityContext);
|
return delegate.placeOrder(body,securityContext);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,19 +19,19 @@ import com.sun.jersey.multipart.FormDataParam;
|
|||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
import javax.ws.rs.core.SecurityContext;
|
import javax.ws.rs.core.SecurityContext;
|
||||||
|
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2016-01-31T21:10:14.319Z")
|
|
||||||
public abstract class StoreApiService {
|
public abstract class StoreApiService {
|
||||||
|
|
||||||
|
public abstract Response deleteOrder(Long orderId,SecurityContext securityContext)
|
||||||
|
throws NotFoundException;
|
||||||
|
|
||||||
public abstract Response getInventory(SecurityContext securityContext)
|
public abstract Response getInventory(SecurityContext securityContext)
|
||||||
throws NotFoundException;
|
throws NotFoundException;
|
||||||
|
|
||||||
|
public abstract Response getOrderById(Long orderId,SecurityContext securityContext)
|
||||||
|
throws NotFoundException;
|
||||||
|
|
||||||
public abstract Response placeOrder(Order body,SecurityContext securityContext)
|
public abstract Response placeOrder(Order body,SecurityContext securityContext)
|
||||||
throws NotFoundException;
|
throws NotFoundException;
|
||||||
|
|
||||||
public abstract Response getOrderById(String orderId,SecurityContext securityContext)
|
|
||||||
throws NotFoundException;
|
|
||||||
|
|
||||||
public abstract Response deleteOrder(String orderId,SecurityContext securityContext)
|
|
||||||
throws NotFoundException;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package io.swagger.api;
|
package io.swagger.api;
|
||||||
|
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2016-01-31T21:10:14.319Z")
|
|
||||||
public class StringUtil {
|
public class StringUtil {
|
||||||
/**
|
/**
|
||||||
* Check if the given array contains the given value (with case-insensitive comparison).
|
* Check if the given array contains the given value (with case-insensitive comparison).
|
||||||
|
@ -9,7 +9,7 @@ import io.swagger.annotations.ApiParam;
|
|||||||
import com.sun.jersey.multipart.FormDataParam;
|
import com.sun.jersey.multipart.FormDataParam;
|
||||||
|
|
||||||
import io.swagger.model.User;
|
import io.swagger.model.User;
|
||||||
import java.util.*;
|
import java.util.List;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import io.swagger.api.NotFoundException;
|
import io.swagger.api.NotFoundException;
|
||||||
@ -28,123 +28,118 @@ import javax.ws.rs.*;
|
|||||||
|
|
||||||
|
|
||||||
@io.swagger.annotations.Api(description = "the user API")
|
@io.swagger.annotations.Api(description = "the user API")
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2016-01-31T21:10:14.319Z")
|
|
||||||
public class UserApi {
|
public class UserApi {
|
||||||
private final UserApiService delegate = UserApiServiceFactory.getUserApi();
|
private final UserApiService delegate = UserApiServiceFactory.getUserApi();
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
|
|
||||||
|
|
||||||
@Produces({ "application/json", "application/xml" })
|
@Produces({ "application/xml", "application/json" })
|
||||||
@io.swagger.annotations.ApiOperation(value = "Create user", notes = "This can only be done by the logged in user.", response = void.class, tags={ "user", })
|
@io.swagger.annotations.ApiOperation(value = "Create user", notes = "This can only be done by the logged in user.", response = void.class, tags={ "user", })
|
||||||
@io.swagger.annotations.ApiResponses(value = {
|
@io.swagger.annotations.ApiResponses(value = {
|
||||||
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = void.class) })
|
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = void.class) })
|
||||||
|
|
||||||
public Response createUser(
|
public Response createUser(
|
||||||
@ApiParam(value = "Created user object" ) User body,@Context SecurityContext securityContext)
|
@ApiParam(value = "Created user object" ,required=true) User body,
|
||||||
|
@Context SecurityContext securityContext)
|
||||||
throws NotFoundException {
|
throws NotFoundException {
|
||||||
return delegate.createUser(body,securityContext);
|
return delegate.createUser(body,securityContext);
|
||||||
}
|
}
|
||||||
@POST
|
@POST
|
||||||
@Path("/createWithArray")
|
@Path("/createWithArray")
|
||||||
|
|
||||||
@Produces({ "application/json", "application/xml" })
|
@Produces({ "application/xml", "application/json" })
|
||||||
@io.swagger.annotations.ApiOperation(value = "Creates list of users with given input array", notes = "", response = void.class, tags={ "user", })
|
@io.swagger.annotations.ApiOperation(value = "Creates list of users with given input array", notes = "", response = void.class, tags={ "user", })
|
||||||
@io.swagger.annotations.ApiResponses(value = {
|
@io.swagger.annotations.ApiResponses(value = {
|
||||||
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = void.class) })
|
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = void.class) })
|
||||||
|
|
||||||
public Response createUsersWithArrayInput(
|
public Response createUsersWithArrayInput(
|
||||||
@ApiParam(value = "List of user object" ) List<User> body,@Context SecurityContext securityContext)
|
@ApiParam(value = "List of user object" ,required=true) List<User> body,
|
||||||
|
@Context SecurityContext securityContext)
|
||||||
throws NotFoundException {
|
throws NotFoundException {
|
||||||
return delegate.createUsersWithArrayInput(body,securityContext);
|
return delegate.createUsersWithArrayInput(body,securityContext);
|
||||||
}
|
}
|
||||||
@POST
|
@POST
|
||||||
@Path("/createWithList")
|
@Path("/createWithList")
|
||||||
|
|
||||||
@Produces({ "application/json", "application/xml" })
|
@Produces({ "application/xml", "application/json" })
|
||||||
@io.swagger.annotations.ApiOperation(value = "Creates list of users with given input array", notes = "", response = void.class, tags={ "user", })
|
@io.swagger.annotations.ApiOperation(value = "Creates list of users with given input array", notes = "", response = void.class, tags={ "user", })
|
||||||
@io.swagger.annotations.ApiResponses(value = {
|
@io.swagger.annotations.ApiResponses(value = {
|
||||||
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = void.class) })
|
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = void.class) })
|
||||||
|
|
||||||
public Response createUsersWithListInput(
|
public Response createUsersWithListInput(
|
||||||
@ApiParam(value = "List of user object" ) List<User> body,@Context SecurityContext securityContext)
|
@ApiParam(value = "List of user object" ,required=true) List<User> body,
|
||||||
|
@Context SecurityContext securityContext)
|
||||||
throws NotFoundException {
|
throws NotFoundException {
|
||||||
return delegate.createUsersWithListInput(body,securityContext);
|
return delegate.createUsersWithListInput(body,securityContext);
|
||||||
}
|
}
|
||||||
|
@DELETE
|
||||||
|
@Path("/{username}")
|
||||||
|
|
||||||
|
@Produces({ "application/xml", "application/json" })
|
||||||
|
@io.swagger.annotations.ApiOperation(value = "Delete user", notes = "This can only be done by the logged in user.", response = void.class, tags={ "user", })
|
||||||
|
@io.swagger.annotations.ApiResponses(value = {
|
||||||
|
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid username supplied", response = void.class),
|
||||||
|
@io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = void.class) })
|
||||||
|
public Response deleteUser(
|
||||||
|
@ApiParam(value = "The name that needs to be deleted",required=true) @PathParam("username") String username,
|
||||||
|
@Context SecurityContext securityContext)
|
||||||
|
throws NotFoundException {
|
||||||
|
return delegate.deleteUser(username,securityContext);
|
||||||
|
}
|
||||||
|
@GET
|
||||||
|
@Path("/{username}")
|
||||||
|
|
||||||
|
@Produces({ "application/xml", "application/json" })
|
||||||
|
@io.swagger.annotations.ApiOperation(value = "Get user by user name", notes = "", response = User.class, tags={ "user", })
|
||||||
|
@io.swagger.annotations.ApiResponses(value = {
|
||||||
|
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = User.class),
|
||||||
|
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid username supplied", response = User.class),
|
||||||
|
@io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = User.class) })
|
||||||
|
public Response getUserByName(
|
||||||
|
@ApiParam(value = "The name that needs to be fetched. Use user1 for testing.",required=true) @PathParam("username") String username,
|
||||||
|
@Context SecurityContext securityContext)
|
||||||
|
throws NotFoundException {
|
||||||
|
return delegate.getUserByName(username,securityContext);
|
||||||
|
}
|
||||||
@GET
|
@GET
|
||||||
@Path("/login")
|
@Path("/login")
|
||||||
|
|
||||||
@Produces({ "application/json", "application/xml" })
|
@Produces({ "application/xml", "application/json" })
|
||||||
@io.swagger.annotations.ApiOperation(value = "Logs user into the system", notes = "", response = String.class, tags={ "user", })
|
@io.swagger.annotations.ApiOperation(value = "Logs user into the system", notes = "", response = String.class, tags={ "user", })
|
||||||
@io.swagger.annotations.ApiResponses(value = {
|
@io.swagger.annotations.ApiResponses(value = {
|
||||||
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = String.class),
|
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = String.class),
|
||||||
|
|
||||||
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid username/password supplied", response = String.class) })
|
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid username/password supplied", response = String.class) })
|
||||||
|
public Response loginUser(
|
||||||
public Response loginUser(@ApiParam(value = "The user name for login") @QueryParam("username") String username
|
@ApiParam(value = "The user name for login",required=true) @QueryParam("username") String username,
|
||||||
,@ApiParam(value = "The password for login in clear text") @QueryParam("password") String password
|
@ApiParam(value = "The password for login in clear text",required=true) @QueryParam("password") String password,
|
||||||
,@Context SecurityContext securityContext)
|
@Context SecurityContext securityContext)
|
||||||
throws NotFoundException {
|
throws NotFoundException {
|
||||||
return delegate.loginUser(username,password,securityContext);
|
return delegate.loginUser(username,password,securityContext);
|
||||||
}
|
}
|
||||||
@GET
|
@GET
|
||||||
@Path("/logout")
|
@Path("/logout")
|
||||||
|
|
||||||
@Produces({ "application/json", "application/xml" })
|
@Produces({ "application/xml", "application/json" })
|
||||||
@io.swagger.annotations.ApiOperation(value = "Logs out current logged in user session", notes = "", response = void.class, tags={ "user", })
|
@io.swagger.annotations.ApiOperation(value = "Logs out current logged in user session", notes = "null", response = void.class, tags={ "user", })
|
||||||
@io.swagger.annotations.ApiResponses(value = {
|
@io.swagger.annotations.ApiResponses(value = {
|
||||||
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = void.class) })
|
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = void.class) })
|
||||||
|
public Response logoutUser(
|
||||||
public Response logoutUser(@Context SecurityContext securityContext)
|
@Context SecurityContext securityContext)
|
||||||
throws NotFoundException {
|
throws NotFoundException {
|
||||||
return delegate.logoutUser(securityContext);
|
return delegate.logoutUser(securityContext);
|
||||||
}
|
}
|
||||||
@GET
|
|
||||||
@Path("/{username}")
|
|
||||||
|
|
||||||
@Produces({ "application/json", "application/xml" })
|
|
||||||
@io.swagger.annotations.ApiOperation(value = "Get user by user name", notes = "", response = User.class, tags={ "user", })
|
|
||||||
@io.swagger.annotations.ApiResponses(value = {
|
|
||||||
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = User.class),
|
|
||||||
|
|
||||||
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid username supplied", response = User.class),
|
|
||||||
|
|
||||||
@io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = User.class) })
|
|
||||||
|
|
||||||
public Response getUserByName(
|
|
||||||
@ApiParam(value = "The name that needs to be fetched. Use user1 for testing.",required=true) @PathParam("username") String username,@Context SecurityContext securityContext)
|
|
||||||
throws NotFoundException {
|
|
||||||
return delegate.getUserByName(username,securityContext);
|
|
||||||
}
|
|
||||||
@PUT
|
@PUT
|
||||||
@Path("/{username}")
|
@Path("/{username}")
|
||||||
|
|
||||||
@Produces({ "application/json", "application/xml" })
|
@Produces({ "application/xml", "application/json" })
|
||||||
@io.swagger.annotations.ApiOperation(value = "Updated user", notes = "This can only be done by the logged in user.", response = void.class, tags={ "user", })
|
@io.swagger.annotations.ApiOperation(value = "Updated user", notes = "This can only be done by the logged in user.", response = void.class, tags={ "user" })
|
||||||
@io.swagger.annotations.ApiResponses(value = {
|
@io.swagger.annotations.ApiResponses(value = {
|
||||||
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid user supplied", response = void.class),
|
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid user supplied", response = void.class),
|
||||||
|
|
||||||
@io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = void.class) })
|
@io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = void.class) })
|
||||||
|
|
||||||
public Response updateUser(
|
public Response updateUser(
|
||||||
@ApiParam(value = "name that need to be deleted",required=true) @PathParam("username") String username,
|
@ApiParam(value = "name that need to be updated",required=true) @PathParam("username") String username,
|
||||||
@ApiParam(value = "Updated user object" ) User body,@Context SecurityContext securityContext)
|
@ApiParam(value = "Updated user object" ,required=true) User body,
|
||||||
|
@Context SecurityContext securityContext)
|
||||||
throws NotFoundException {
|
throws NotFoundException {
|
||||||
return delegate.updateUser(username,body,securityContext);
|
return delegate.updateUser(username,body,securityContext);
|
||||||
}
|
}
|
||||||
@DELETE
|
|
||||||
@Path("/{username}")
|
|
||||||
|
|
||||||
@Produces({ "application/json", "application/xml" })
|
|
||||||
@io.swagger.annotations.ApiOperation(value = "Delete user", notes = "This can only be done by the logged in user.", response = void.class, tags={ "user" })
|
|
||||||
@io.swagger.annotations.ApiResponses(value = {
|
|
||||||
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid username supplied", response = void.class),
|
|
||||||
|
|
||||||
@io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = void.class) })
|
|
||||||
|
|
||||||
public Response deleteUser(
|
|
||||||
@ApiParam(value = "The name that needs to be deleted",required=true) @PathParam("username") String username,@Context SecurityContext securityContext)
|
|
||||||
throws NotFoundException {
|
|
||||||
return delegate.deleteUser(username,securityContext);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ import io.swagger.model.*;
|
|||||||
import com.sun.jersey.multipart.FormDataParam;
|
import com.sun.jersey.multipart.FormDataParam;
|
||||||
|
|
||||||
import io.swagger.model.User;
|
import io.swagger.model.User;
|
||||||
import java.util.*;
|
import java.util.List;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import io.swagger.api.NotFoundException;
|
import io.swagger.api.NotFoundException;
|
||||||
@ -19,7 +19,7 @@ import com.sun.jersey.multipart.FormDataParam;
|
|||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
import javax.ws.rs.core.SecurityContext;
|
import javax.ws.rs.core.SecurityContext;
|
||||||
|
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2016-01-31T21:10:14.319Z")
|
|
||||||
public abstract class UserApiService {
|
public abstract class UserApiService {
|
||||||
|
|
||||||
public abstract Response createUser(User body,SecurityContext securityContext)
|
public abstract Response createUser(User body,SecurityContext securityContext)
|
||||||
@ -31,19 +31,19 @@ public abstract class UserApiService {
|
|||||||
public abstract Response createUsersWithListInput(List<User> body,SecurityContext securityContext)
|
public abstract Response createUsersWithListInput(List<User> body,SecurityContext securityContext)
|
||||||
throws NotFoundException;
|
throws NotFoundException;
|
||||||
|
|
||||||
|
public abstract Response deleteUser(String username,SecurityContext securityContext)
|
||||||
|
throws NotFoundException;
|
||||||
|
|
||||||
|
public abstract Response getUserByName(String username,SecurityContext securityContext)
|
||||||
|
throws NotFoundException;
|
||||||
|
|
||||||
public abstract Response loginUser(String username,String password,SecurityContext securityContext)
|
public abstract Response loginUser(String username,String password,SecurityContext securityContext)
|
||||||
throws NotFoundException;
|
throws NotFoundException;
|
||||||
|
|
||||||
public abstract Response logoutUser(SecurityContext securityContext)
|
public abstract Response logoutUser(SecurityContext securityContext)
|
||||||
throws NotFoundException;
|
throws NotFoundException;
|
||||||
|
|
||||||
public abstract Response getUserByName(String username,SecurityContext securityContext)
|
|
||||||
throws NotFoundException;
|
|
||||||
|
|
||||||
public abstract Response updateUser(String username,User body,SecurityContext securityContext)
|
public abstract Response updateUser(String username,User body,SecurityContext securityContext)
|
||||||
throws NotFoundException;
|
throws NotFoundException;
|
||||||
|
|
||||||
public abstract Response deleteUser(String username,SecurityContext securityContext)
|
|
||||||
throws NotFoundException;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,117 @@
|
|||||||
|
package io.swagger.model;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public class ApiResponse {
|
||||||
|
|
||||||
|
private Integer code = null;
|
||||||
|
private String type = null;
|
||||||
|
private String message = null;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
**/
|
||||||
|
public ApiResponse code(Integer code) {
|
||||||
|
this.code = code;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "")
|
||||||
|
@JsonProperty("code")
|
||||||
|
public Integer getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
public void setCode(Integer code) {
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
**/
|
||||||
|
public ApiResponse type(String type) {
|
||||||
|
this.type = type;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "")
|
||||||
|
@JsonProperty("type")
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
public void setType(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
**/
|
||||||
|
public ApiResponse message(String message) {
|
||||||
|
this.message = message;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "")
|
||||||
|
@JsonProperty("message")
|
||||||
|
public String getMessage() {
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
public void setMessage(String message) {
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (o == null || getClass() != o.getClass()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
ApiResponse apiResponse = (ApiResponse) o;
|
||||||
|
return Objects.equals(code, apiResponse.code) &&
|
||||||
|
Objects.equals(type, apiResponse.type) &&
|
||||||
|
Objects.equals(message, apiResponse.message);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(code, type, message);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append("class ApiResponse {\n");
|
||||||
|
|
||||||
|
sb.append(" code: ").append(toIndentedString(code)).append("\n");
|
||||||
|
sb.append(" type: ").append(toIndentedString(type)).append("\n");
|
||||||
|
sb.append(" message: ").append(toIndentedString(message)).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 ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -2,7 +2,6 @@ package io.swagger.model;
|
|||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
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;
|
||||||
|
|
||||||
@ -10,7 +9,7 @@ import io.swagger.annotations.ApiModelProperty;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2016-01-31T21:10:14.319Z")
|
|
||||||
public class Category {
|
public class Category {
|
||||||
|
|
||||||
private Long id = null;
|
private Long id = null;
|
||||||
@ -19,6 +18,11 @@ public class Category {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
**/
|
**/
|
||||||
|
public Category id(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "")
|
@ApiModelProperty(value = "")
|
||||||
@JsonProperty("id")
|
@JsonProperty("id")
|
||||||
@ -32,6 +36,11 @@ public class Category {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
**/
|
**/
|
||||||
|
public Category name(String name) {
|
||||||
|
this.name = name;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "")
|
@ApiModelProperty(value = "")
|
||||||
@JsonProperty("name")
|
@JsonProperty("name")
|
||||||
|
@ -11,7 +11,7 @@ import java.util.Date;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2016-01-31T21:10:14.319Z")
|
|
||||||
public class Order {
|
public class Order {
|
||||||
|
|
||||||
private Long id = null;
|
private Long id = null;
|
||||||
@ -39,11 +39,16 @@ public class Order {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private StatusEnum status = null;
|
private StatusEnum status = null;
|
||||||
private Boolean complete = null;
|
private Boolean complete = false;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
**/
|
**/
|
||||||
|
public Order id(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "")
|
@ApiModelProperty(value = "")
|
||||||
@JsonProperty("id")
|
@JsonProperty("id")
|
||||||
@ -57,6 +62,11 @@ public class Order {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
**/
|
**/
|
||||||
|
public Order petId(Long petId) {
|
||||||
|
this.petId = petId;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "")
|
@ApiModelProperty(value = "")
|
||||||
@JsonProperty("petId")
|
@JsonProperty("petId")
|
||||||
@ -70,6 +80,11 @@ public class Order {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
**/
|
**/
|
||||||
|
public Order quantity(Integer quantity) {
|
||||||
|
this.quantity = quantity;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "")
|
@ApiModelProperty(value = "")
|
||||||
@JsonProperty("quantity")
|
@JsonProperty("quantity")
|
||||||
@ -83,6 +98,11 @@ public class Order {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
**/
|
**/
|
||||||
|
public Order shipDate(Date shipDate) {
|
||||||
|
this.shipDate = shipDate;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "")
|
@ApiModelProperty(value = "")
|
||||||
@JsonProperty("shipDate")
|
@JsonProperty("shipDate")
|
||||||
@ -97,6 +117,11 @@ public class Order {
|
|||||||
/**
|
/**
|
||||||
* Order Status
|
* Order Status
|
||||||
**/
|
**/
|
||||||
|
public Order status(StatusEnum status) {
|
||||||
|
this.status = status;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "Order Status")
|
@ApiModelProperty(value = "Order Status")
|
||||||
@JsonProperty("status")
|
@JsonProperty("status")
|
||||||
@ -110,6 +135,11 @@ public class Order {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
**/
|
**/
|
||||||
|
public Order complete(Boolean complete) {
|
||||||
|
this.complete = complete;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "")
|
@ApiModelProperty(value = "")
|
||||||
@JsonProperty("complete")
|
@JsonProperty("complete")
|
||||||
|
@ -7,13 +7,14 @@ import io.swagger.annotations.ApiModel;
|
|||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import io.swagger.model.Category;
|
import io.swagger.model.Category;
|
||||||
import io.swagger.model.Tag;
|
import io.swagger.model.Tag;
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2016-01-31T21:10:14.319Z")
|
|
||||||
public class Pet {
|
public class Pet {
|
||||||
|
|
||||||
private Long id = null;
|
private Long id = null;
|
||||||
@ -46,6 +47,11 @@ public class Pet {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
**/
|
**/
|
||||||
|
public Pet id(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "")
|
@ApiModelProperty(value = "")
|
||||||
@JsonProperty("id")
|
@JsonProperty("id")
|
||||||
@ -59,6 +65,11 @@ public class Pet {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
**/
|
**/
|
||||||
|
public Pet category(Category category) {
|
||||||
|
this.category = category;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "")
|
@ApiModelProperty(value = "")
|
||||||
@JsonProperty("category")
|
@JsonProperty("category")
|
||||||
@ -72,8 +83,13 @@ public class Pet {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
**/
|
**/
|
||||||
|
public Pet name(String name) {
|
||||||
|
this.name = name;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
@ApiModelProperty(required = true, value = "")
|
|
||||||
|
@ApiModelProperty(example = "doggie", required = true, value = "")
|
||||||
@JsonProperty("name")
|
@JsonProperty("name")
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
@ -85,6 +101,11 @@ public class Pet {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
**/
|
**/
|
||||||
|
public Pet photoUrls(List<String> photoUrls) {
|
||||||
|
this.photoUrls = photoUrls;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiModelProperty(required = true, value = "")
|
@ApiModelProperty(required = true, value = "")
|
||||||
@JsonProperty("photoUrls")
|
@JsonProperty("photoUrls")
|
||||||
@ -98,6 +119,11 @@ public class Pet {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
**/
|
**/
|
||||||
|
public Pet tags(List<Tag> tags) {
|
||||||
|
this.tags = tags;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "")
|
@ApiModelProperty(value = "")
|
||||||
@JsonProperty("tags")
|
@JsonProperty("tags")
|
||||||
@ -112,6 +138,11 @@ public class Pet {
|
|||||||
/**
|
/**
|
||||||
* pet status in the store
|
* pet status in the store
|
||||||
**/
|
**/
|
||||||
|
public Pet status(StatusEnum status) {
|
||||||
|
this.status = status;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "pet status in the store")
|
@ApiModelProperty(value = "pet status in the store")
|
||||||
@JsonProperty("status")
|
@JsonProperty("status")
|
||||||
|
@ -2,7 +2,6 @@ package io.swagger.model;
|
|||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
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;
|
||||||
|
|
||||||
@ -10,7 +9,7 @@ import io.swagger.annotations.ApiModelProperty;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2016-01-31T21:10:14.319Z")
|
|
||||||
public class Tag {
|
public class Tag {
|
||||||
|
|
||||||
private Long id = null;
|
private Long id = null;
|
||||||
@ -19,6 +18,11 @@ public class Tag {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
**/
|
**/
|
||||||
|
public Tag id(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "")
|
@ApiModelProperty(value = "")
|
||||||
@JsonProperty("id")
|
@JsonProperty("id")
|
||||||
@ -32,6 +36,11 @@ public class Tag {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
**/
|
**/
|
||||||
|
public Tag name(String name) {
|
||||||
|
this.name = name;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "")
|
@ApiModelProperty(value = "")
|
||||||
@JsonProperty("name")
|
@JsonProperty("name")
|
||||||
|
@ -2,7 +2,6 @@ package io.swagger.model;
|
|||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
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;
|
||||||
|
|
||||||
@ -10,7 +9,7 @@ import io.swagger.annotations.ApiModelProperty;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2016-01-31T21:10:14.319Z")
|
|
||||||
public class User {
|
public class User {
|
||||||
|
|
||||||
private Long id = null;
|
private Long id = null;
|
||||||
@ -25,6 +24,11 @@ public class User {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
**/
|
**/
|
||||||
|
public User id(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "")
|
@ApiModelProperty(value = "")
|
||||||
@JsonProperty("id")
|
@JsonProperty("id")
|
||||||
@ -38,6 +42,11 @@ public class User {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
**/
|
**/
|
||||||
|
public User username(String username) {
|
||||||
|
this.username = username;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "")
|
@ApiModelProperty(value = "")
|
||||||
@JsonProperty("username")
|
@JsonProperty("username")
|
||||||
@ -51,6 +60,11 @@ public class User {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
**/
|
**/
|
||||||
|
public User firstName(String firstName) {
|
||||||
|
this.firstName = firstName;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "")
|
@ApiModelProperty(value = "")
|
||||||
@JsonProperty("firstName")
|
@JsonProperty("firstName")
|
||||||
@ -64,6 +78,11 @@ public class User {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
**/
|
**/
|
||||||
|
public User lastName(String lastName) {
|
||||||
|
this.lastName = lastName;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "")
|
@ApiModelProperty(value = "")
|
||||||
@JsonProperty("lastName")
|
@JsonProperty("lastName")
|
||||||
@ -77,6 +96,11 @@ public class User {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
**/
|
**/
|
||||||
|
public User email(String email) {
|
||||||
|
this.email = email;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "")
|
@ApiModelProperty(value = "")
|
||||||
@JsonProperty("email")
|
@JsonProperty("email")
|
||||||
@ -90,6 +114,11 @@ public class User {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
**/
|
**/
|
||||||
|
public User password(String password) {
|
||||||
|
this.password = password;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "")
|
@ApiModelProperty(value = "")
|
||||||
@JsonProperty("password")
|
@JsonProperty("password")
|
||||||
@ -103,6 +132,11 @@ public class User {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
**/
|
**/
|
||||||
|
public User phone(String phone) {
|
||||||
|
this.phone = phone;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "")
|
@ApiModelProperty(value = "")
|
||||||
@JsonProperty("phone")
|
@JsonProperty("phone")
|
||||||
@ -117,6 +151,11 @@ public class User {
|
|||||||
/**
|
/**
|
||||||
* User Status
|
* User Status
|
||||||
**/
|
**/
|
||||||
|
public User userStatus(Integer userStatus) {
|
||||||
|
this.userStatus = userStatus;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "User Status")
|
@ApiModelProperty(value = "User Status")
|
||||||
@JsonProperty("userStatus")
|
@JsonProperty("userStatus")
|
||||||
|
@ -3,7 +3,7 @@ package io.swagger.api.factories;
|
|||||||
import io.swagger.api.PetApiService;
|
import io.swagger.api.PetApiService;
|
||||||
import io.swagger.api.impl.PetApiServiceImpl;
|
import io.swagger.api.impl.PetApiServiceImpl;
|
||||||
|
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2016-01-14T21:37:36.074Z")
|
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2016-04-03T13:30:41.715-06:00")
|
||||||
public class PetApiServiceFactory {
|
public class PetApiServiceFactory {
|
||||||
|
|
||||||
private final static PetApiService service = new PetApiServiceImpl();
|
private final static PetApiService service = new PetApiServiceImpl();
|
||||||
|
@ -1,15 +0,0 @@
|
|||||||
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.JaxRSServerCodegen", date = "2016-01-14T21:37:36.074Z")
|
|
||||||
public class PettestingByteArraytrueApiServiceFactory {
|
|
||||||
|
|
||||||
private final static PettestingByteArraytrueApiService service = new PettestingByteArraytrueApiServiceImpl();
|
|
||||||
|
|
||||||
public static PettestingByteArraytrueApiService getPettestingByteArraytrueApi()
|
|
||||||
{
|
|
||||||
return service;
|
|
||||||
}
|
|
||||||
}
|
|
@ -3,7 +3,7 @@ package io.swagger.api.factories;
|
|||||||
import io.swagger.api.StoreApiService;
|
import io.swagger.api.StoreApiService;
|
||||||
import io.swagger.api.impl.StoreApiServiceImpl;
|
import io.swagger.api.impl.StoreApiServiceImpl;
|
||||||
|
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2016-01-14T21:37:36.074Z")
|
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2016-04-03T13:30:41.715-06:00")
|
||||||
public class StoreApiServiceFactory {
|
public class StoreApiServiceFactory {
|
||||||
|
|
||||||
private final static StoreApiService service = new StoreApiServiceImpl();
|
private final static StoreApiService service = new StoreApiServiceImpl();
|
||||||
|
@ -3,7 +3,7 @@ package io.swagger.api.factories;
|
|||||||
import io.swagger.api.UserApiService;
|
import io.swagger.api.UserApiService;
|
||||||
import io.swagger.api.impl.UserApiServiceImpl;
|
import io.swagger.api.impl.UserApiServiceImpl;
|
||||||
|
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2016-01-14T21:37:36.074Z")
|
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2016-04-03T13:30:41.715-06:00")
|
||||||
public class UserApiServiceFactory {
|
public class UserApiServiceFactory {
|
||||||
|
|
||||||
private final static UserApiService service = new UserApiServiceImpl();
|
private final static UserApiService service = new UserApiServiceImpl();
|
||||||
|
@ -6,6 +6,7 @@ import io.swagger.model.*;
|
|||||||
import com.sun.jersey.multipart.FormDataParam;
|
import com.sun.jersey.multipart.FormDataParam;
|
||||||
|
|
||||||
import io.swagger.model.Pet;
|
import io.swagger.model.Pet;
|
||||||
|
import io.swagger.model.ApiResponse;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -19,18 +20,18 @@ import com.sun.jersey.multipart.FormDataParam;
|
|||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
import javax.ws.rs.core.SecurityContext;
|
import javax.ws.rs.core.SecurityContext;
|
||||||
|
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2016-01-14T21:37:36.074Z")
|
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2016-04-03T13:30:41.715-06:00")
|
||||||
public class PetApiServiceImpl extends PetApiService {
|
public class PetApiServiceImpl extends PetApiService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Response updatePet(Pet body,SecurityContext securityContext)
|
public Response addPet(Pet body, 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();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Response addPet(Pet body,SecurityContext securityContext)
|
public Response deletePet(Long petId, String apiKey, 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();
|
||||||
@ -58,14 +59,14 @@ public class PetApiServiceImpl extends PetApiService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Response updatePetWithForm(String petId,String name,String status,SecurityContext securityContext)
|
public Response updatePet(Pet body, 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();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Response deletePet(Long petId,String apiKey,SecurityContext securityContext)
|
public Response updatePetWithForm(Long petId, String name, String status, 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();
|
||||||
@ -78,11 +79,4 @@ public class PetApiServiceImpl extends PetApiService {
|
|||||||
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
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();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,30 +0,0 @@
|
|||||||
package io.swagger.api.impl;
|
|
||||||
|
|
||||||
import io.swagger.api.*;
|
|
||||||
import io.swagger.model.*;
|
|
||||||
|
|
||||||
import com.sun.jersey.multipart.FormDataParam;
|
|
||||||
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import io.swagger.api.NotFoundException;
|
|
||||||
|
|
||||||
import java.io.InputStream;
|
|
||||||
|
|
||||||
import com.sun.jersey.core.header.FormDataContentDisposition;
|
|
||||||
import com.sun.jersey.multipart.FormDataParam;
|
|
||||||
|
|
||||||
import javax.ws.rs.core.Response;
|
|
||||||
import javax.ws.rs.core.SecurityContext;
|
|
||||||
|
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2016-01-14T21:37:36.074Z")
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -19,9 +19,16 @@ import com.sun.jersey.multipart.FormDataParam;
|
|||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
import javax.ws.rs.core.SecurityContext;
|
import javax.ws.rs.core.SecurityContext;
|
||||||
|
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2016-01-14T21:37:36.074Z")
|
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2016-04-03T13:30:41.715-06:00")
|
||||||
public class StoreApiServiceImpl extends StoreApiService {
|
public class StoreApiServiceImpl extends StoreApiService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Response deleteOrder(Long orderId, SecurityContext securityContext)
|
||||||
|
throws NotFoundException {
|
||||||
|
// do some magic!
|
||||||
|
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Response getInventory(SecurityContext securityContext)
|
public Response getInventory(SecurityContext securityContext)
|
||||||
throws NotFoundException {
|
throws NotFoundException {
|
||||||
@ -29,6 +36,13 @@ public class StoreApiServiceImpl extends StoreApiService {
|
|||||||
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Response getOrderById(Long orderId, SecurityContext securityContext)
|
||||||
|
throws NotFoundException {
|
||||||
|
// do some magic!
|
||||||
|
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Response placeOrder(Order body, SecurityContext securityContext)
|
public Response placeOrder(Order body, SecurityContext securityContext)
|
||||||
throws NotFoundException {
|
throws NotFoundException {
|
||||||
@ -36,18 +50,4 @@ public class StoreApiServiceImpl extends StoreApiService {
|
|||||||
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
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();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ import io.swagger.model.*;
|
|||||||
import com.sun.jersey.multipart.FormDataParam;
|
import com.sun.jersey.multipart.FormDataParam;
|
||||||
|
|
||||||
import io.swagger.model.User;
|
import io.swagger.model.User;
|
||||||
import java.util.*;
|
import java.util.List;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import io.swagger.api.NotFoundException;
|
import io.swagger.api.NotFoundException;
|
||||||
@ -19,7 +19,7 @@ import com.sun.jersey.multipart.FormDataParam;
|
|||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
import javax.ws.rs.core.SecurityContext;
|
import javax.ws.rs.core.SecurityContext;
|
||||||
|
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2016-01-14T21:37:36.074Z")
|
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2016-04-03T13:30:41.715-06:00")
|
||||||
public class UserApiServiceImpl extends UserApiService {
|
public class UserApiServiceImpl extends UserApiService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -43,6 +43,20 @@ public class UserApiServiceImpl extends UserApiService {
|
|||||||
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Response getUserByName(String username, SecurityContext securityContext)
|
||||||
|
throws NotFoundException {
|
||||||
|
// do some magic!
|
||||||
|
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Response loginUser(String username, String password, SecurityContext securityContext)
|
public Response loginUser(String username, String password, SecurityContext securityContext)
|
||||||
throws NotFoundException {
|
throws NotFoundException {
|
||||||
@ -57,13 +71,6 @@ public class UserApiServiceImpl extends UserApiService {
|
|||||||
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
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
|
@Override
|
||||||
public Response updateUser(String username, User body, SecurityContext securityContext)
|
public Response updateUser(String username, User body, SecurityContext securityContext)
|
||||||
throws NotFoundException {
|
throws NotFoundException {
|
||||||
@ -71,11 +78,4 @@ public class UserApiServiceImpl extends UserApiService {
|
|||||||
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
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();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
23
samples/server/petstore/jersey2/README.md
Normal file
23
samples/server/petstore/jersey2/README.md
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# Swagger Jersey 2 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!
|
145
samples/server/petstore/jersey2/pom.xml
Normal file
145
samples/server/petstore/jersey2/pom.xml
Normal file
@ -0,0 +1,145 @@
|
|||||||
|
<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-server</artifactId>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
<name>swagger-jaxrs-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.eclipse.jetty</groupId>
|
||||||
|
<artifactId>jetty-maven-plugin</artifactId>
|
||||||
|
<version>${jetty-version}</version>
|
||||||
|
<configuration>
|
||||||
|
<webApp>
|
||||||
|
<contextPath>/</contextPath>
|
||||||
|
</webApp>
|
||||||
|
<webAppSourceDirectory>target/${project.artifactId}-${project.version}</webAppSourceDirectory>
|
||||||
|
<stopPort>8079</stopPort>
|
||||||
|
<stopKey>stopit</stopKey>
|
||||||
|
<httpConnector>
|
||||||
|
<port>8080</port>
|
||||||
|
<idleTimeout>60000</idleTimeout>
|
||||||
|
</httpConnector>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>start-jetty</id>
|
||||||
|
<phase>pre-integration-test</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>start</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<scanIntervalSeconds>0</scanIntervalSeconds>
|
||||||
|
<daemon>true</daemon>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
<execution>
|
||||||
|
<id>stop-jetty</id>
|
||||||
|
<phase>post-integration-test</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>stop</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>io.swagger</groupId>
|
||||||
|
<artifactId>swagger-jersey2-jaxrs</artifactId>
|
||||||
|
<scope>compile</scope>
|
||||||
|
<version>${swagger-core-version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>ch.qos.logback</groupId>
|
||||||
|
<artifactId>logback-classic</artifactId>
|
||||||
|
<version>${logback-version}</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>ch.qos.logback</groupId>
|
||||||
|
<artifactId>logback-core</artifactId>
|
||||||
|
<version>${logback-version}</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
<version>${junit-version}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.servlet</groupId>
|
||||||
|
<artifactId>servlet-api</artifactId>
|
||||||
|
<version>${servlet-api-version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.glassfish.jersey.containers</groupId>
|
||||||
|
<artifactId>jersey-container-servlet-core</artifactId>
|
||||||
|
<version>${jersey2-version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.glassfish.jersey.media</groupId>
|
||||||
|
<artifactId>jersey-media-multipart</artifactId>
|
||||||
|
<version>${jersey2-version}</version>
|
||||||
|
</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.8</swagger-core-version>
|
||||||
|
<jetty-version>9.2.9.v20150224</jetty-version>
|
||||||
|
<jersey2-version>2.6</jersey2-version>
|
||||||
|
<slf4j-version>1.6.3</slf4j-version>
|
||||||
|
<junit-version>4.8.1</junit-version>
|
||||||
|
<logback-version>1.0.1</logback-version>
|
||||||
|
<servlet-api-version>2.5</servlet-api-version>
|
||||||
|
</properties>
|
||||||
|
</project>
|
@ -0,0 +1,10 @@
|
|||||||
|
package io.swagger.api;
|
||||||
|
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
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,31 @@
|
|||||||
|
package io.swagger.api;
|
||||||
|
|
||||||
|
import io.swagger.jaxrs.config.SwaggerContextService;
|
||||||
|
import io.swagger.models.*;
|
||||||
|
|
||||||
|
import io.swagger.models.auth.*;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServlet;
|
||||||
|
import javax.servlet.ServletContext;
|
||||||
|
import javax.servlet.ServletConfig;
|
||||||
|
import javax.servlet.ServletException;
|
||||||
|
|
||||||
|
public class Bootstrap extends HttpServlet {
|
||||||
|
@Override
|
||||||
|
public void init(ServletConfig config) throws ServletException {
|
||||||
|
Info info = new Info()
|
||||||
|
.title("Swagger Server")
|
||||||
|
.description("This is a sample server Petstore server. You can find out more about\nSwagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/).\nFor this sample, you can use the api key `special-key` to test the authorization filters.\n")
|
||||||
|
.termsOfService("http://swagger.io/terms/")
|
||||||
|
.contact(new Contact()
|
||||||
|
.email("apiteam@swagger.io"))
|
||||||
|
.license(new License()
|
||||||
|
.name("Apache 2.0")
|
||||||
|
.url("http://www.apache.org/licenses/LICENSE-2.0.html"));
|
||||||
|
|
||||||
|
ServletContext context = config.getServletContext();
|
||||||
|
Swagger swagger = new Swagger().info(info);
|
||||||
|
|
||||||
|
new SwaggerContextService().withServletConfig(config).updateSwagger(swagger);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
package io.swagger.api;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider;
|
||||||
|
import io.swagger.util.Json;
|
||||||
|
|
||||||
|
import javax.ws.rs.Produces;
|
||||||
|
import javax.ws.rs.core.MediaType;
|
||||||
|
import javax.ws.rs.ext.Provider;
|
||||||
|
|
||||||
|
@Provider
|
||||||
|
@Produces({MediaType.APPLICATION_JSON})
|
||||||
|
public class JacksonJsonProvider extends JacksonJaxbJsonProvider {
|
||||||
|
private static ObjectMapper commonMapper = Json.mapper();
|
||||||
|
|
||||||
|
public JacksonJsonProvider() {
|
||||||
|
super.setMapper(commonMapper);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,10 @@
|
|||||||
|
package io.swagger.api;
|
||||||
|
|
||||||
|
|
||||||
|
public class NotFoundException extends ApiException {
|
||||||
|
private int code;
|
||||||
|
public NotFoundException (int code, String msg) {
|
||||||
|
super(code, msg);
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,175 @@
|
|||||||
|
package io.swagger.api;
|
||||||
|
|
||||||
|
import io.swagger.model.*;
|
||||||
|
import io.swagger.api.PetApiService;
|
||||||
|
import io.swagger.api.factories.PetApiServiceFactory;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiParam;
|
||||||
|
|
||||||
|
import io.swagger.model.Pet;
|
||||||
|
import io.swagger.model.ApiResponse;
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import io.swagger.api.NotFoundException;
|
||||||
|
|
||||||
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
|
||||||
|
import org.glassfish.jersey.media.multipart.FormDataParam;
|
||||||
|
|
||||||
|
import javax.ws.rs.core.Context;
|
||||||
|
import javax.ws.rs.core.Response;
|
||||||
|
import javax.ws.rs.core.SecurityContext;
|
||||||
|
import javax.ws.rs.*;
|
||||||
|
|
||||||
|
@Path("/pet")
|
||||||
|
|
||||||
|
|
||||||
|
@io.swagger.annotations.Api(description = "the pet API")
|
||||||
|
|
||||||
|
public class PetApi {
|
||||||
|
private final PetApiService delegate = PetApiServiceFactory.getPetApi();
|
||||||
|
|
||||||
|
@POST
|
||||||
|
|
||||||
|
@Consumes({ "application/json", "application/xml" })
|
||||||
|
@Produces({ "application/xml", "application/json" })
|
||||||
|
@io.swagger.annotations.ApiOperation(value = "Add a new pet to the store", notes = "", response = void.class, authorizations = {
|
||||||
|
@io.swagger.annotations.Authorization(value = "petstore_auth", scopes = {
|
||||||
|
@io.swagger.annotations.AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
||||||
|
@io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets")
|
||||||
|
})
|
||||||
|
}, tags={ "pet", })
|
||||||
|
@io.swagger.annotations.ApiResponses(value = {
|
||||||
|
@io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = void.class) })
|
||||||
|
public Response addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true) Pet body,@Context SecurityContext securityContext)
|
||||||
|
throws NotFoundException {
|
||||||
|
return delegate.addPet(body,securityContext);
|
||||||
|
}
|
||||||
|
@DELETE
|
||||||
|
@Path("/{petId}")
|
||||||
|
|
||||||
|
@Produces({ "application/xml", "application/json" })
|
||||||
|
@io.swagger.annotations.ApiOperation(value = "Deletes a pet", notes = "", response = void.class, authorizations = {
|
||||||
|
@io.swagger.annotations.Authorization(value = "petstore_auth", scopes = {
|
||||||
|
@io.swagger.annotations.AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
||||||
|
@io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets")
|
||||||
|
})
|
||||||
|
}, tags={ "pet", })
|
||||||
|
@io.swagger.annotations.ApiResponses(value = {
|
||||||
|
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = void.class),
|
||||||
|
|
||||||
|
@io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found", response = void.class) })
|
||||||
|
public Response deletePet(@ApiParam(value = "Pet id to delete",required=true) @PathParam("petId") Long petId,@ApiParam(value = "" )@HeaderParam("api_key") String apiKey,@Context SecurityContext securityContext)
|
||||||
|
throws NotFoundException {
|
||||||
|
return delegate.deletePet(petId,apiKey,securityContext);
|
||||||
|
}
|
||||||
|
@GET
|
||||||
|
@Path("/findByStatus")
|
||||||
|
|
||||||
|
@Produces({ "application/xml", "application/json" })
|
||||||
|
@io.swagger.annotations.ApiOperation(value = "Finds Pets by status", notes = "Multiple status values can be provided with comma separated strings", response = Pet.class, responseContainer = "List", authorizations = {
|
||||||
|
@io.swagger.annotations.Authorization(value = "petstore_auth", scopes = {
|
||||||
|
@io.swagger.annotations.AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
||||||
|
@io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets")
|
||||||
|
})
|
||||||
|
}, tags={ "pet", })
|
||||||
|
@io.swagger.annotations.ApiResponses(value = {
|
||||||
|
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"),
|
||||||
|
|
||||||
|
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid status value", response = Pet.class, responseContainer = "List") })
|
||||||
|
public Response findPetsByStatus(@ApiParam(value = "Status values that need to be considered for filter",required=true) @QueryParam("status") List<String> status,@Context SecurityContext securityContext)
|
||||||
|
throws NotFoundException {
|
||||||
|
return delegate.findPetsByStatus(status,securityContext);
|
||||||
|
}
|
||||||
|
@GET
|
||||||
|
@Path("/findByTags")
|
||||||
|
|
||||||
|
@Produces({ "application/xml", "application/json" })
|
||||||
|
@io.swagger.annotations.ApiOperation(value = "Finds Pets by tags", notes = "Muliple tags can be provided with comma separated strings. Use\ntag1, tag2, tag3 for testing.\n", response = Pet.class, responseContainer = "List", authorizations = {
|
||||||
|
@io.swagger.annotations.Authorization(value = "petstore_auth", scopes = {
|
||||||
|
@io.swagger.annotations.AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
||||||
|
@io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets")
|
||||||
|
})
|
||||||
|
}, tags={ "pet", })
|
||||||
|
@io.swagger.annotations.ApiResponses(value = {
|
||||||
|
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"),
|
||||||
|
|
||||||
|
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid tag value", response = Pet.class, responseContainer = "List") })
|
||||||
|
public Response findPetsByTags(@ApiParam(value = "Tags to filter by",required=true) @QueryParam("tags") List<String> tags,@Context SecurityContext securityContext)
|
||||||
|
throws NotFoundException {
|
||||||
|
return delegate.findPetsByTags(tags,securityContext);
|
||||||
|
}
|
||||||
|
@GET
|
||||||
|
@Path("/{petId}")
|
||||||
|
|
||||||
|
@Produces({ "application/xml", "application/json" })
|
||||||
|
@io.swagger.annotations.ApiOperation(value = "Find pet by ID", notes = "Returns a single pet", response = Pet.class, authorizations = {
|
||||||
|
@io.swagger.annotations.Authorization(value = "api_key")
|
||||||
|
}, tags={ "pet", })
|
||||||
|
@io.swagger.annotations.ApiResponses(value = {
|
||||||
|
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class),
|
||||||
|
|
||||||
|
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = Pet.class),
|
||||||
|
|
||||||
|
@io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found", response = Pet.class) })
|
||||||
|
public Response getPetById(@ApiParam(value = "ID of pet to return",required=true) @PathParam("petId") Long petId,@Context SecurityContext securityContext)
|
||||||
|
throws NotFoundException {
|
||||||
|
return delegate.getPetById(petId,securityContext);
|
||||||
|
}
|
||||||
|
@PUT
|
||||||
|
|
||||||
|
@Consumes({ "application/json", "application/xml" })
|
||||||
|
@Produces({ "application/xml", "application/json" })
|
||||||
|
@io.swagger.annotations.ApiOperation(value = "Update an existing pet", notes = "", response = void.class, authorizations = {
|
||||||
|
@io.swagger.annotations.Authorization(value = "petstore_auth", scopes = {
|
||||||
|
@io.swagger.annotations.AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
||||||
|
@io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets")
|
||||||
|
})
|
||||||
|
}, tags={ "pet", })
|
||||||
|
@io.swagger.annotations.ApiResponses(value = {
|
||||||
|
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = void.class),
|
||||||
|
|
||||||
|
@io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found", response = void.class),
|
||||||
|
|
||||||
|
@io.swagger.annotations.ApiResponse(code = 405, message = "Validation exception", response = void.class) })
|
||||||
|
public Response updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true) Pet body,@Context SecurityContext securityContext)
|
||||||
|
throws NotFoundException {
|
||||||
|
return delegate.updatePet(body,securityContext);
|
||||||
|
}
|
||||||
|
@POST
|
||||||
|
@Path("/{petId}")
|
||||||
|
@Consumes({ "application/x-www-form-urlencoded" })
|
||||||
|
@Produces({ "application/xml", "application/json" })
|
||||||
|
@io.swagger.annotations.ApiOperation(value = "Updates a pet in the store with form data", notes = "null", response = void.class, authorizations = {
|
||||||
|
@io.swagger.annotations.Authorization(value = "petstore_auth", scopes = {
|
||||||
|
@io.swagger.annotations.AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
||||||
|
@io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets")
|
||||||
|
})
|
||||||
|
}, tags={ "pet", })
|
||||||
|
@io.swagger.annotations.ApiResponses(value = {
|
||||||
|
@io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = void.class) })
|
||||||
|
public Response updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true) @PathParam("petId") Long petId,@ApiParam(value = "Updated name of the pet")@FormParam("name") String name,@ApiParam(value = "Updated status of the pet")@FormParam("status") String status,@Context SecurityContext securityContext)
|
||||||
|
throws NotFoundException {
|
||||||
|
return delegate.updatePetWithForm(petId,name,status,securityContext);
|
||||||
|
}
|
||||||
|
@POST
|
||||||
|
@Path("/{petId}/uploadImage")
|
||||||
|
@Consumes({ "multipart/form-data" })
|
||||||
|
@Produces({ "application/json" })
|
||||||
|
@io.swagger.annotations.ApiOperation(value = "uploads an image", notes = "", response = ApiResponse.class, authorizations = {
|
||||||
|
@io.swagger.annotations.Authorization(value = "petstore_auth", scopes = {
|
||||||
|
@io.swagger.annotations.AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
||||||
|
@io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets")
|
||||||
|
})
|
||||||
|
}, tags={ "pet", })
|
||||||
|
@io.swagger.annotations.ApiResponses(value = {
|
||||||
|
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = ApiResponse.class) })
|
||||||
|
public Response uploadFile(@ApiParam(value = "ID of pet to update",required=true) @PathParam("petId") Long petId,@ApiParam(value = "Additional data to pass to server")@FormDataParam("additionalMetadata") String additionalMetadata,
|
||||||
|
@FormDataParam("file") InputStream inputStream,
|
||||||
|
@FormDataParam("file") FormDataContentDisposition fileDetail,@Context SecurityContext securityContext)
|
||||||
|
throws NotFoundException {
|
||||||
|
return delegate.uploadFile(petId,additionalMetadata,inputStream, fileDetail,securityContext);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,39 @@
|
|||||||
|
package io.swagger.api;
|
||||||
|
|
||||||
|
import io.swagger.api.*;
|
||||||
|
import io.swagger.model.*;
|
||||||
|
|
||||||
|
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
|
||||||
|
|
||||||
|
import io.swagger.model.Pet;
|
||||||
|
import io.swagger.model.ApiResponse;
|
||||||
|
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;
|
||||||
|
|
||||||
|
|
||||||
|
public abstract class PetApiService {
|
||||||
|
|
||||||
|
public abstract Response addPet(Pet body,SecurityContext securityContext) throws NotFoundException;
|
||||||
|
|
||||||
|
public abstract Response deletePet(Long petId,String apiKey,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 updatePet(Pet body,SecurityContext securityContext) throws NotFoundException;
|
||||||
|
|
||||||
|
public abstract Response updatePetWithForm(Long petId,String name,String status,SecurityContext securityContext) throws NotFoundException;
|
||||||
|
|
||||||
|
public abstract Response uploadFile(Long petId,String additionalMetadata,InputStream inputStream, FormDataContentDisposition fileDetail,SecurityContext securityContext) throws NotFoundException;
|
||||||
|
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user