forked from loafle/openapi-generator-original
Merge branch 'master' of https://github.com/swagger-api/swagger-codegen
This commit is contained in:
@@ -858,6 +858,7 @@ Here are some companies/projects using Swagger Codegen in production. To add you
|
||||
- [goTransverse](http://www.gotransverse.com/api)
|
||||
- [GraphHopper](https://graphhopper.com/)
|
||||
- [Gravitate Solutions](http://gravitatesolutions.com/)
|
||||
- [HashData](http://www.hashdata.cn/)
|
||||
- [Hewlett Packard Enterprise](https://hpe.com)
|
||||
- [High Technologies Center](http://htc-cs.com)
|
||||
- [IMS Health](http://www.imshealth.com/en/solution-areas/technology-and-applications)
|
||||
|
||||
3
bin/windows/swift-petstore-all.bat
Executable file
3
bin/windows/swift-petstore-all.bat
Executable file
@@ -0,0 +1,3 @@
|
||||
call .\bin\windows\swift-petstore.bat
|
||||
call .\bin\windows\swift-petstore-promisekit.bat
|
||||
call .\bin\windows\swift-petstore-rxswift.bat
|
||||
10
bin/windows/swift-petstore-promisekit.bat
Executable file
10
bin/windows/swift-petstore-promisekit.bat
Executable file
@@ -0,0 +1,10 @@
|
||||
set executable=.\modules\swagger-codegen-cli\target\swagger-codegen-cli.jar
|
||||
|
||||
If Not Exist %executable% (
|
||||
mvn clean package
|
||||
)
|
||||
|
||||
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M
|
||||
set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l swift -c bin\swift-petstore-promisekit.json -o samples\client\petstore\swift\promisekit
|
||||
|
||||
java %JAVA_OPTS% -jar %executable% %ags%
|
||||
10
bin/windows/swift-petstore-rxswift.bat
Executable file
10
bin/windows/swift-petstore-rxswift.bat
Executable file
@@ -0,0 +1,10 @@
|
||||
set executable=.\modules\swagger-codegen-cli\target\swagger-codegen-cli.jar
|
||||
|
||||
If Not Exist %executable% (
|
||||
mvn clean package
|
||||
)
|
||||
|
||||
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M
|
||||
set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l swift -c bin\swift-petstore-rxswift.json -o samples\client\petstore\swift\rxswift
|
||||
|
||||
java %JAVA_OPTS% -jar %executable% %ags%
|
||||
@@ -5,6 +5,6 @@ If Not Exist %executable% (
|
||||
)
|
||||
|
||||
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M
|
||||
set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l swift -o samples\client\petstore\swift
|
||||
set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l swift -o samples\client\petstore\swift\default
|
||||
|
||||
java %JAVA_OPTS% -jar %executable% %ags%
|
||||
|
||||
3
bin/windows/swift3-petstore-all.bat
Executable file
3
bin/windows/swift3-petstore-all.bat
Executable file
@@ -0,0 +1,3 @@
|
||||
call .\bin\windows\swift3-petstore.bat
|
||||
call .\bin\windows\swift3-petstore-promisekit.bat
|
||||
call .\bin\windows\swift3-petstore-rxswift.bat
|
||||
10
bin/windows/swift3-petstore-promisekit.bat
Executable file
10
bin/windows/swift3-petstore-promisekit.bat
Executable file
@@ -0,0 +1,10 @@
|
||||
set executable=.\modules\swagger-codegen-cli\target\swagger-codegen-cli.jar
|
||||
|
||||
If Not Exist %executable% (
|
||||
mvn clean package
|
||||
)
|
||||
|
||||
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M
|
||||
set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -l swift3 -c bin\swift3-petstore-promisekit.json -o samples\client\petstore\swift3\promisekit
|
||||
|
||||
java %JAVA_OPTS% -jar %executable% %ags%
|
||||
10
bin/windows/swift3-petstore-rxswift.bat
Executable file
10
bin/windows/swift3-petstore-rxswift.bat
Executable file
@@ -0,0 +1,10 @@
|
||||
set executable=.\modules\swagger-codegen-cli\target\swagger-codegen-cli.jar
|
||||
|
||||
If Not Exist %executable% (
|
||||
mvn clean package
|
||||
)
|
||||
|
||||
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M
|
||||
set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -l swift3 -c bin\swift3-petstore-rxswift.json -o samples\client\petstore\swift3\rxswift
|
||||
|
||||
java %JAVA_OPTS% -jar %executable% %ags%
|
||||
10
bin/windows/swift3-petstore.bat
Executable file
10
bin/windows/swift3-petstore.bat
Executable file
@@ -0,0 +1,10 @@
|
||||
set executable=.\modules\swagger-codegen-cli\target\swagger-codegen-cli.jar
|
||||
|
||||
If Not Exist %executable% (
|
||||
mvn clean package
|
||||
)
|
||||
|
||||
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M
|
||||
set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -l swift3 -o samples\client\petstore\swift3\default
|
||||
|
||||
java %JAVA_OPTS% -jar %executable% %ags%
|
||||
@@ -21,30 +21,30 @@ import io.swagger.codegen.languages.features.LoggingTestFeatures;
|
||||
import io.swagger.models.Operation;
|
||||
|
||||
public class JavaCXFClientCodegen extends AbstractJavaCodegen
|
||||
implements BeanValidationFeatures, JaxbFeatures, GzipTestFeatures, LoggingTestFeatures
|
||||
{
|
||||
implements BeanValidationFeatures, JaxbFeatures, GzipTestFeatures, LoggingTestFeatures
|
||||
{
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(JavaCXFClientCodegen.class);
|
||||
|
||||
|
||||
/**
|
||||
* Name of the sub-directory in "src/main/resource" where to find the
|
||||
* Mustache template for the JAX-RS Codegen.
|
||||
*/
|
||||
protected static final String JAXRS_TEMPLATE_DIRECTORY_NAME = "JavaJaxRS";
|
||||
|
||||
|
||||
protected boolean useJaxbAnnotations = true;
|
||||
|
||||
protected boolean useBeanValidation = false;
|
||||
|
||||
|
||||
protected boolean useGzipFeatureForTests = false;
|
||||
|
||||
|
||||
protected boolean useLoggingFeatureForTests = false;
|
||||
|
||||
|
||||
public JavaCXFClientCodegen()
|
||||
{
|
||||
super();
|
||||
|
||||
supportsInheritance = true;
|
||||
|
||||
|
||||
sourceFolder = "src/gen/java";
|
||||
invokerPackage = "io.swagger.api";
|
||||
artifactId = "swagger-jaxrs-client";
|
||||
@@ -52,9 +52,9 @@ public class JavaCXFClientCodegen extends AbstractJavaCodegen
|
||||
|
||||
apiPackage = "io.swagger.api";
|
||||
modelPackage = "io.swagger.model";
|
||||
|
||||
|
||||
outputFolder = "generated-code/JavaJaxRS-CXF";
|
||||
|
||||
|
||||
// clear model and api doc template as this codegen
|
||||
// does not support auto-generated markdown doc at the moment
|
||||
//TODO: add doc templates
|
||||
@@ -63,7 +63,6 @@ public class JavaCXFClientCodegen extends AbstractJavaCodegen
|
||||
|
||||
|
||||
typeMapping.put("date", "LocalDate");
|
||||
typeMapping.put("DateTime", "javax.xml.datatype.XMLGregorianCalendar"); // Map DateTime fields to Java standart class 'XMLGregorianCalendar'
|
||||
|
||||
importMapping.put("LocalDate", "org.joda.time.LocalDate");
|
||||
|
||||
@@ -72,11 +71,11 @@ public class JavaCXFClientCodegen extends AbstractJavaCodegen
|
||||
cliOptions.add(CliOption.newBoolean(USE_JAXB_ANNOTATIONS, "Use JAXB annotations for XML"));
|
||||
|
||||
cliOptions.add(CliOption.newBoolean(USE_BEANVALIDATION, "Use BeanValidation API annotations"));
|
||||
|
||||
|
||||
cliOptions.add(CliOption.newBoolean(USE_GZIP_FEATURE_FOR_TESTS, "Use Gzip Feature for tests"));
|
||||
cliOptions.add(CliOption.newBoolean(USE_LOGGING_FEATURE_FOR_TESTS, "Use Logging Feature for tests"));
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -84,7 +83,7 @@ public class JavaCXFClientCodegen extends AbstractJavaCodegen
|
||||
public void processOpts()
|
||||
{
|
||||
super.processOpts();
|
||||
|
||||
|
||||
if (additionalProperties.containsKey(USE_JAXB_ANNOTATIONS)) {
|
||||
boolean useJaxbAnnotationsProp = convertPropertyToBooleanAndWriteBack(USE_JAXB_ANNOTATIONS);
|
||||
this.setUseJaxbAnnotations(useJaxbAnnotationsProp);
|
||||
@@ -94,15 +93,15 @@ public class JavaCXFClientCodegen extends AbstractJavaCodegen
|
||||
boolean useBeanValidationProp = convertPropertyToBooleanAndWriteBack(USE_BEANVALIDATION);
|
||||
this.setUseBeanValidation(useBeanValidationProp);
|
||||
}
|
||||
|
||||
|
||||
this.setUseGzipFeatureForTests(convertPropertyToBooleanAndWriteBack(USE_GZIP_FEATURE_FOR_TESTS));
|
||||
this.setUseLoggingFeatureForTests(convertPropertyToBooleanAndWriteBack(USE_LOGGING_FEATURE_FOR_TESTS));
|
||||
|
||||
|
||||
|
||||
|
||||
supportingFiles.clear(); // Don't need extra files provided by AbstractJAX-RS & Java Codegen
|
||||
|
||||
|
||||
writeOptional(outputFolder, new SupportingFile("pom.mustache", "", "pom.xml"));
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -117,13 +116,13 @@ public class JavaCXFClientCodegen extends AbstractJavaCodegen
|
||||
{
|
||||
return CodegenType.CLIENT;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void addOperationToGroup(String tag, String resourcePath, Operation operation, CodegenOperation co, Map<String, List<CodegenOperation>> operations) {
|
||||
super.addOperationToGroup(tag, resourcePath, operation, co, operations);
|
||||
super.addOperationToGroup(tag, resourcePath, operation, co, operations);
|
||||
co.subresourceOperation = !co.path.isEmpty();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void postProcessModelProperty(CodegenModel model, CodegenProperty property) {
|
||||
super.postProcessModelProperty(model, property);
|
||||
@@ -132,17 +131,17 @@ public class JavaCXFClientCodegen extends AbstractJavaCodegen
|
||||
model.imports.remove("JsonSerialize");
|
||||
model.imports.remove("ToStringSerializer");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getHelp()
|
||||
{
|
||||
return "Generates a Java JAXRS Client based on Apache CXF framework.";
|
||||
}
|
||||
|
||||
|
||||
public void setUseBeanValidation(boolean useBeanValidation) {
|
||||
this.useBeanValidation = useBeanValidation;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setUseJaxbAnnotations(boolean useJaxbAnnotations) {
|
||||
this.useJaxbAnnotations = useJaxbAnnotations;
|
||||
|
||||
@@ -78,7 +78,6 @@ public class JavaCXFServerCodegen extends AbstractJavaJAXRSServerCodegen
|
||||
|
||||
|
||||
typeMapping.put("date", "LocalDate");
|
||||
typeMapping.put("DateTime", "javax.xml.datatype.XMLGregorianCalendar"); // Map DateTime fields to Java standart class 'XMLGregorianCalendar'
|
||||
|
||||
importMapping.put("LocalDate", "org.joda.time.LocalDate");
|
||||
|
||||
|
||||
@@ -21,9 +21,9 @@ import io.swagger.models.Swagger;
|
||||
import io.swagger.models.properties.Property;
|
||||
import io.swagger.util.Json;
|
||||
|
||||
public class JavaJAXRSSpecServerCodegen extends AbstractJavaJAXRSServerCodegen
|
||||
{
|
||||
|
||||
public class JavaJAXRSSpecServerCodegen extends AbstractJavaJAXRSServerCodegen
|
||||
{
|
||||
|
||||
public JavaJAXRSSpecServerCodegen()
|
||||
{
|
||||
super();
|
||||
@@ -48,7 +48,6 @@ public class JavaJAXRSSpecServerCodegen extends AbstractJavaJAXRSServerCodegen
|
||||
additionalProperties.put("title", title);
|
||||
|
||||
typeMapping.put("date", "LocalDate");
|
||||
typeMapping.put("DateTime", "javax.xml.datatype.XMLGregorianCalendar"); // Map DateTime fields to Java standart class 'XMLGregorianCalendar'
|
||||
|
||||
importMapping.put("LocalDate", "org.joda.time.LocalDate");
|
||||
|
||||
@@ -60,7 +59,7 @@ public class JavaJAXRSSpecServerCodegen extends AbstractJavaJAXRSServerCodegen
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
CliOption library = new CliOption(CodegenConstants.LIBRARY, "library template (sub-template) to use");
|
||||
library.setDefault(DEFAULT_LIBRARY);
|
||||
|
||||
@@ -71,20 +70,20 @@ public class JavaJAXRSSpecServerCodegen extends AbstractJavaJAXRSServerCodegen
|
||||
|
||||
cliOptions.add(library);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void processOpts()
|
||||
{
|
||||
super.processOpts();
|
||||
|
||||
|
||||
supportingFiles.clear(); // Don't need extra files provided by AbstractJAX-RS & Java Codegen
|
||||
writeOptional(outputFolder, new SupportingFile("pom.mustache", "", "pom.xml"));
|
||||
|
||||
|
||||
writeOptional(outputFolder, new SupportingFile("RestApplication.mustache",
|
||||
(sourceFolder + '/' + invokerPackage).replace(".", "/"), "RestApplication.java"));
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
@@ -119,7 +118,7 @@ public class JavaJAXRSSpecServerCodegen extends AbstractJavaJAXRSServerCodegen
|
||||
opList.add(co);
|
||||
co.baseName = basePath;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void postProcessModelProperty(CodegenModel model, CodegenProperty property) {
|
||||
super.postProcessModelProperty(model, property);
|
||||
@@ -130,10 +129,10 @@ public class JavaJAXRSSpecServerCodegen extends AbstractJavaJAXRSServerCodegen
|
||||
model.imports.remove("JsonValue");
|
||||
model.imports.remove("JsonProperty");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void preprocessSwagger(Swagger swagger) {
|
||||
//copy input swagger to output folder
|
||||
//copy input swagger to output folder
|
||||
try {
|
||||
String swaggerJson = Json.pretty(swagger);
|
||||
FileUtils.writeStringToFile(new File(outputFolder + File.separator + "swagger.json"), swaggerJson);
|
||||
|
||||
@@ -1,15 +1,24 @@
|
||||
package io.swagger.codegen.languages;
|
||||
|
||||
import io.swagger.codegen.*;
|
||||
import io.swagger.codegen.CliOption;
|
||||
import io.swagger.codegen.CodegenConfig;
|
||||
import io.swagger.codegen.CodegenConstants;
|
||||
import io.swagger.codegen.CodegenOperation;
|
||||
import io.swagger.codegen.CodegenParameter;
|
||||
import io.swagger.codegen.CodegenResponse;
|
||||
import io.swagger.codegen.CodegenType;
|
||||
import io.swagger.codegen.DefaultCodegen;
|
||||
import io.swagger.codegen.SupportingFile;
|
||||
import io.swagger.models.Info;
|
||||
import io.swagger.models.Model;
|
||||
import io.swagger.models.Operation;
|
||||
import io.swagger.models.Swagger;
|
||||
import io.swagger.models.properties.ArrayProperty;
|
||||
import io.swagger.models.properties.MapProperty;
|
||||
import io.swagger.models.properties.Property;
|
||||
import io.swagger.models.Info;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
@@ -113,6 +122,11 @@ public class StaticHtml2Generator extends DefaultCodegen implements CodegenConfi
|
||||
List<CodegenOperation> operationList = (List<CodegenOperation>) operations.get("operation");
|
||||
for (CodegenOperation op : operationList) {
|
||||
op.httpMethod = op.httpMethod.toLowerCase();
|
||||
for (CodegenResponse response : op.responses){
|
||||
if ("0".equals(response.code)){
|
||||
response.code = "default";
|
||||
}
|
||||
}
|
||||
}
|
||||
return objs;
|
||||
}
|
||||
|
||||
@@ -160,6 +160,18 @@
|
||||
<version>${cxf-version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.jaxrs</groupId>
|
||||
<artifactId>jackson-jaxrs-json-provider</artifactId>
|
||||
<version>${jackson-jaxrs-version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||
<artifactId>jackson-datatype-joda</artifactId>
|
||||
<version>${jackson-jaxrs-version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
{{#generateSpringApplication}}
|
||||
<!-- Spring -->
|
||||
<dependency>
|
||||
@@ -233,6 +245,7 @@
|
||||
<spring.boot-version>1.3.3.RELEASE</spring.boot-version>
|
||||
{{/generateSpringBootApplication}}
|
||||
<cxf-version>3.1.8</cxf-version>
|
||||
<jackson-jaxrs-version>2.8.4</jackson-jaxrs-version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
</project>
|
||||
|
||||
@@ -1 +1 @@
|
||||
{{#isFormParam}}{{#notFile}}@ApiParam(value = "{{{description}}}"{{#required}}, required=true{{/required}} {{#allowableValues}}, allowableValues="{{{allowableValues}}}"{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}) @RequestParam(value="{{paramName}}"{{#required}}, required=true{{/required}}{{^required}}, required=false{{/required}}) {{{dataType}}} {{paramName}}{{/notFile}}{{#isFile}}@ApiParam(value = "file detail") @RequestParam("file") MultipartFile {{baseName}}{{/isFile}}{{/isFormParam}}
|
||||
{{#isFormParam}}{{#notFile}}@ApiParam(value = "{{{description}}}"{{#required}}, required=true{{/required}} {{#allowableValues}}, allowableValues="{{{allowableValues}}}"{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}) @RequestParam(value="{{baseName}}"{{#required}}, required=true{{/required}}{{^required}}, required=false{{/required}}) {{{dataType}}} {{paramName}}{{/notFile}}{{#isFile}}@ApiParam(value = "file detail") @RequestParam("{{baseName}}") MultipartFile {{paramName}}{{/isFile}}{{/isFormParam}}
|
||||
@@ -452,9 +452,12 @@
|
||||
* or the constructor function for a complex type. Pass an array containing the type name to return an array of that type. To
|
||||
* return an object, pass an object with one property whose name is the key type and whose value is the corresponding value type:
|
||||
* all properties on <code>data<code> will be converted to this type.
|
||||
* @returns An instance of the specified type.
|
||||
* @returns An instance of the specified type or null or undefined if data is null or undefined.
|
||||
*/
|
||||
{{/emitJSDoc}} exports.convertToType = function(data, type) {
|
||||
if (data === null || data === undefined)
|
||||
return data
|
||||
|
||||
switch (type) {
|
||||
case 'Boolean':
|
||||
return Boolean(data);
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <QDebug>
|
||||
#include <QJsonArray>
|
||||
#include <QJsonValue>
|
||||
#include <QDateTime>
|
||||
|
||||
namespace Swagger {
|
||||
|
||||
|
||||
@@ -12,8 +12,9 @@ case class {{classname}} (
|
||||
{{#description}}
|
||||
/* {{{description}}} */
|
||||
{{/description}}
|
||||
{{name}}: {{{datatype}}}{{#hasMore}},{{/hasMore}}
|
||||
{{{name}}}: {{^required}}Option[{{/required}}{{datatype}}{{^required}}]{{/required}}{{#hasMore}},{{/hasMore}}
|
||||
{{/vars}}
|
||||
)
|
||||
|
||||
{{/model}}
|
||||
{{/models}}
|
||||
|
||||
@@ -23,12 +23,23 @@ scalaVersion := "2.11.2"
|
||||
scalacOptions += "-language:postfixOps"
|
||||
|
||||
libraryDependencies ++= Seq(
|
||||
"com.github.finagle" %% "finch-core" % "0.9.2-SNAPSHOT" changing(),
|
||||
"com.github.finagle" %% "finch-argonaut" % "0.9.2-SNAPSHOT" changing(),
|
||||
"io.argonaut" %% "argonaut" % "6.1",
|
||||
"com.github.finagle" %% "finch-test" % "0.9.2-SNAPSHOT" % "test,it" changing(),
|
||||
"org.scalacheck" %% "scalacheck" % "1.12.5" % "test,it",
|
||||
"org.scalatest" %% "scalatest" % "2.2.5" % "test,it"
|
||||
"org.scalatest" %% "scalatest" % "2.2.1" % "test",
|
||||
"org.scalatra" %% "scalatra" % "2.3.0.RC3",
|
||||
"org.scalatra" %% "scalatra-scalate" % "2.3.0.RC3",
|
||||
"org.scalatra" %% "scalatra-json" % "2.3.0.RC3",
|
||||
"org.scalatra" %% "scalatra-swagger" % "2.3.0.RC3",
|
||||
"org.scalatra" %% "scalatra-swagger-ext" % "2.3.0.RC3",
|
||||
"org.scalatra" %% "scalatra-slf4j" % "2.3.0.RC3",
|
||||
"org.json4s" %% "json4s-jackson" % "3.2.10",
|
||||
"org.json4s" %% "json4s-ext" % "3.2.10",
|
||||
"commons-codec" % "commons-codec" % "1.7",
|
||||
"net.databinder.dispatch" %% "dispatch-core" % "0.11.2",
|
||||
//"net.databinder.dispatch" %% "json4s-jackson" % "0.11.2",
|
||||
"net.databinder.dispatch" %% "dispatch-json4s-jackson" % "0.11.2",
|
||||
"com.typesafe.akka" %% "akka-actor" % "2.3.6",
|
||||
"org.eclipse.jetty" % "jetty-server" % "9.2.3.v20140905" % "container;compile;test",
|
||||
"org.eclipse.jetty" % "jetty-webapp" % "9.2.3.v20140905" % "container;compile;test",
|
||||
"org.eclipse.jetty.orbit" % "javax.servlet" % "3.0.0.v201112011016" % "container;compile;provided;test" artifacts (Artifact("javax.servlet", "jar", "jar"))
|
||||
)
|
||||
|
||||
resolvers += "Local Maven Repository" at "file://"+Path.userHome.absolutePath+"/.m2/repository"
|
||||
@@ -37,9 +48,6 @@ resolvers += "Sonatype OSS Snapshots" at "http://oss.sonatype.org/content/reposi
|
||||
|
||||
resolvers += "Sonatype OSS Releases" at "http://oss.sonatype.org/content/repositories/releases/"
|
||||
|
||||
resolvers += "TM" at "http://maven.twttr.com"
|
||||
|
||||
|
||||
ivyXML := <dependencies>
|
||||
<exclude module="slf4j-log4j12"/>
|
||||
<exclude module="grizzled-slf4j_2.9.1"/>
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
swagger: '2.0'
|
||||
info:
|
||||
description: 'Test for response code default'
|
||||
version: 1.0.0
|
||||
title: Response code test
|
||||
basePath: /
|
||||
paths:
|
||||
/test:
|
||||
get:
|
||||
summary: Test
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
200:
|
||||
description: successful operation
|
||||
default:
|
||||
description: Internal server error
|
||||
@@ -442,9 +442,12 @@
|
||||
* or the constructor function for a complex type. Pass an array containing the type name to return an array of that type. To
|
||||
* return an object, pass an object with one property whose name is the key type and whose value is the corresponding value type:
|
||||
* all properties on <code>data<code> will be converted to this type.
|
||||
* @returns An instance of the specified type.
|
||||
* @returns An instance of the specified type or null or undefined if data is null or undefined.
|
||||
*/
|
||||
exports.convertToType = function(data, type) {
|
||||
if (data === null || data === undefined)
|
||||
return data
|
||||
|
||||
switch (type) {
|
||||
case 'Boolean':
|
||||
return Boolean(data);
|
||||
|
||||
@@ -14,7 +14,8 @@ package io.swagger.client.model
|
||||
|
||||
|
||||
case class ApiResponse (
|
||||
code: Integer,
|
||||
_type: String,
|
||||
message: String
|
||||
code: Option[Integer],
|
||||
_type: Option[String],
|
||||
message: Option[String]
|
||||
)
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ package io.swagger.client.model
|
||||
|
||||
|
||||
case class Category (
|
||||
id: Long,
|
||||
name: String
|
||||
id: Option[Long],
|
||||
name: Option[String]
|
||||
)
|
||||
|
||||
|
||||
@@ -15,11 +15,12 @@ package io.swagger.client.model
|
||||
import org.joda.time.DateTime
|
||||
|
||||
case class Order (
|
||||
id: Long,
|
||||
petId: Long,
|
||||
quantity: Integer,
|
||||
shipDate: DateTime,
|
||||
id: Option[Long],
|
||||
petId: Option[Long],
|
||||
quantity: Option[Integer],
|
||||
shipDate: Option[DateTime],
|
||||
/* Order Status */
|
||||
status: String,
|
||||
complete: Boolean
|
||||
status: Option[String],
|
||||
complete: Option[Boolean]
|
||||
)
|
||||
|
||||
|
||||
@@ -14,11 +14,12 @@ package io.swagger.client.model
|
||||
|
||||
|
||||
case class Pet (
|
||||
id: Long,
|
||||
category: Category,
|
||||
id: Option[Long],
|
||||
category: Option[Category],
|
||||
name: String,
|
||||
photoUrls: List[String],
|
||||
tags: List[Tag],
|
||||
tags: Option[List[Tag]],
|
||||
/* pet status in the store */
|
||||
status: String
|
||||
status: Option[String]
|
||||
)
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ package io.swagger.client.model
|
||||
|
||||
|
||||
case class Tag (
|
||||
id: Long,
|
||||
name: String
|
||||
id: Option[Long],
|
||||
name: Option[String]
|
||||
)
|
||||
|
||||
|
||||
@@ -14,13 +14,14 @@ package io.swagger.client.model
|
||||
|
||||
|
||||
case class User (
|
||||
id: Long,
|
||||
username: String,
|
||||
firstName: String,
|
||||
lastName: String,
|
||||
email: String,
|
||||
password: String,
|
||||
phone: String,
|
||||
id: Option[Long],
|
||||
username: Option[String],
|
||||
firstName: Option[String],
|
||||
lastName: Option[String],
|
||||
email: Option[String],
|
||||
password: Option[String],
|
||||
phone: Option[String],
|
||||
/* User Status */
|
||||
userStatus: Integer
|
||||
userStatus: Option[Integer]
|
||||
)
|
||||
|
||||
|
||||
@@ -17,22 +17,22 @@ class PetApiTest extends FlatSpec with Matchers {
|
||||
|
||||
it should "add and fetch a pet" in {
|
||||
val pet = Pet(
|
||||
1000,
|
||||
Category(1, "sold"),
|
||||
Some(1000),
|
||||
Some(Category(Some(1), Some("sold"))),
|
||||
"dragon",
|
||||
(for (i <- (1 to 10)) yield "http://foo.com/photo/" + i).toList,
|
||||
(for (i <- (1 to 5)) yield io.swagger.client.model.Tag(i, "tag-" + i)).toList,
|
||||
"lost"
|
||||
Some((for (i <- (1 to 5)) yield io.swagger.client.model.Tag(Some(i), Some("tag-" + i))).toList),
|
||||
Some("lost")
|
||||
)
|
||||
|
||||
api.addPet(pet)
|
||||
api.getPetById(1000) match {
|
||||
case Some(pet) => {
|
||||
pet.id should be(1000)
|
||||
pet.tags.size should be(5)
|
||||
pet.status should be("lost")
|
||||
pet.id should be(Some(1000))
|
||||
pet.tags.get.size should be(5)
|
||||
pet.status should be(Some("lost"))
|
||||
pet.category should not be (null)
|
||||
pet.category.name should be("sold")
|
||||
pet.category.get.name should be(Some("sold"))
|
||||
pet.name should be("dragon")
|
||||
pet.photoUrls.size should be(10)
|
||||
}
|
||||
@@ -42,12 +42,12 @@ class PetApiTest extends FlatSpec with Matchers {
|
||||
|
||||
it should "update a pet" in {
|
||||
val pet = Pet(
|
||||
1000,
|
||||
Category(1, "sold"),
|
||||
Some(1000),
|
||||
Some(Category(Some(1), Some("sold"))),
|
||||
"programmer",
|
||||
(for (i <- (1 to 10)) yield "http://foo.com/photo/" + i).toList,
|
||||
(for (i <- (1 to 5)) yield io.swagger.client.model.Tag(i, "tag-" + i)).toList,
|
||||
"confused"
|
||||
Some((for (i <- (1 to 5)) yield io.swagger.client.model.Tag(Some(i), Some("tag-" + i))).toList),
|
||||
Some("confused")
|
||||
)
|
||||
|
||||
api.addPet(pet)
|
||||
@@ -55,16 +55,16 @@ class PetApiTest extends FlatSpec with Matchers {
|
||||
api.getPetById(1000) match {
|
||||
case Some(pet) => {
|
||||
pet.name should be("programmer")
|
||||
pet.status should be("confused")
|
||||
pet.status should be(Some("confused"))
|
||||
}
|
||||
case None => fail("didn't find pet created")
|
||||
}
|
||||
val updatedPet = pet.copy(status = "fulfilled")
|
||||
val updatedPet = pet.copy(status = Some("fulfilled"))
|
||||
api.updatePet(updatedPet)
|
||||
api.getPetById(1000) match {
|
||||
case Some(pet) => {
|
||||
pet.name should be("programmer")
|
||||
pet.status should be("fulfilled")
|
||||
pet.status should be(Some("fulfilled"))
|
||||
}
|
||||
case None => fail("didn't find pet updated")
|
||||
}
|
||||
@@ -83,8 +83,8 @@ class PetApiTest extends FlatSpec with Matchers {
|
||||
api.findPetsByTags(List("tag1", "tag2")) match {
|
||||
case Some(pets) => {
|
||||
pets.foreach(pet => {
|
||||
val tags = (for (tag <- pet.tags) yield tag.name).toSet
|
||||
if ((tags & Set("tag1", "tag2")).size == 0)
|
||||
val tags = (for (tag <- pet.tags.get) yield tag.name).toSet
|
||||
if ((tags & Set(Some("tag1"), Some("tag2"))).size == 0)
|
||||
fail("unexpected tags in " + tags)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -20,22 +20,22 @@ class StoreApiTest extends FlatSpec with Matchers {
|
||||
it should "place and fetch an order" in {
|
||||
val now = new org.joda.time.DateTime
|
||||
val order = Order(
|
||||
petId = 10,
|
||||
id = 1000,
|
||||
quantity = 101,
|
||||
status = "pending",
|
||||
shipDate = now,
|
||||
complete = true)
|
||||
petId = Some(10),
|
||||
id = Some(1000),
|
||||
quantity = Some(101),
|
||||
status = Some("pending"),
|
||||
shipDate = Some(now),
|
||||
complete = Some(true))
|
||||
|
||||
api.placeOrder(order)
|
||||
|
||||
api.getOrderById(1000) match {
|
||||
case Some(order) => {
|
||||
order.id should be(1000)
|
||||
order.petId should be(10)
|
||||
order.quantity should be(101)
|
||||
order.id should be(Some(1000))
|
||||
order.petId should be(Some(10))
|
||||
order.quantity should be(Some(101))
|
||||
// use `getMillis` to compare across timezones
|
||||
order.shipDate.getMillis.equals(now.getMillis) should be(true)
|
||||
order.shipDate.get.getMillis.equals(now.getMillis) should be(true)
|
||||
}
|
||||
case None => fail("didn't find order created")
|
||||
}
|
||||
@@ -44,17 +44,17 @@ class StoreApiTest extends FlatSpec with Matchers {
|
||||
it should "delete an order" in {
|
||||
val now = new org.joda.time.DateTime
|
||||
val order = Order(
|
||||
id = 1001,
|
||||
petId = 10,
|
||||
quantity = 101,
|
||||
status = "pending",
|
||||
shipDate = now,
|
||||
complete = true)
|
||||
id = Some(1001),
|
||||
petId = Some(10),
|
||||
quantity = Some(101),
|
||||
status = Some("pending"),
|
||||
shipDate = Some(now),
|
||||
complete = Some(true))
|
||||
|
||||
api.placeOrder(order)
|
||||
|
||||
api.getOrderById(1001) match {
|
||||
case Some(order) => order.id should be(1001)
|
||||
case Some(order) => order.id should be(Some(1001))
|
||||
case None => fail("didn't find order created")
|
||||
}
|
||||
|
||||
|
||||
@@ -19,14 +19,14 @@ class UserApiTest extends FlatSpec with Matchers with BeforeAndAfterAll {
|
||||
// preparation before running a test
|
||||
override def beforeAll() {
|
||||
val user = User(
|
||||
11222,
|
||||
"scala-test-username",
|
||||
"scala-test-first",
|
||||
"scala-test-last",
|
||||
"scala_test@fail.com",
|
||||
"SCALATEST",
|
||||
"408-867-5309",
|
||||
1)
|
||||
Some(11222),
|
||||
Some("scala-test-username"),
|
||||
Some("scala-test-first"),
|
||||
Some("scala-test-last"),
|
||||
Some("scala_test@fail.com"),
|
||||
Some("SCALATEST"),
|
||||
Some("408-867-5309"),
|
||||
Some(1))
|
||||
|
||||
api.createUser(user)
|
||||
}
|
||||
@@ -39,14 +39,14 @@ class UserApiTest extends FlatSpec with Matchers with BeforeAndAfterAll {
|
||||
it should "fetch a user" in {
|
||||
api.getUserByName("scala-test-username") match {
|
||||
case Some(user) => {
|
||||
user.id should be(11222)
|
||||
user.username should be("scala-test-username")
|
||||
user.password should be("SCALATEST")
|
||||
user.email should be("scala_test@fail.com")
|
||||
user.firstName should be("scala-test-first")
|
||||
user.lastName should be("scala-test-last")
|
||||
user.phone should be("408-867-5309")
|
||||
user.userStatus should be(1)
|
||||
user.id should be(Some(11222))
|
||||
user.username should be(Some("scala-test-username"))
|
||||
user.password should be(Some("SCALATEST"))
|
||||
user.email should be(Some("scala_test@fail.com"))
|
||||
user.firstName should be(Some("scala-test-first"))
|
||||
user.lastName should be(Some("scala-test-last"))
|
||||
user.phone should be(Some("408-867-5309"))
|
||||
user.userStatus should be(Some(1))
|
||||
}
|
||||
case None =>
|
||||
}
|
||||
@@ -69,22 +69,22 @@ class UserApiTest extends FlatSpec with Matchers with BeforeAndAfterAll {
|
||||
it should "create 2 users" in {
|
||||
val userArray = (for (i <- (1 to 2)) yield {
|
||||
User(
|
||||
2000 + i,
|
||||
"johnny-" + i,
|
||||
"Johnny",
|
||||
"Rocket-" + i,
|
||||
"johnny-" + i + "@fail.com",
|
||||
"XXXXXXXXXXX",
|
||||
"408-867-5309",
|
||||
1)
|
||||
Some(2000 + i),
|
||||
Some("johnny-" + i),
|
||||
Some("Johnny"),
|
||||
Some("Rocket-" + i),
|
||||
Some("johnny-" + i + "@fail.com"),
|
||||
Some("XXXXXXXXXXX"),
|
||||
Some("408-867-5309"),
|
||||
Some(1))
|
||||
}).toList
|
||||
api.createUsersWithArrayInput(userArray)
|
||||
|
||||
for (i <- (1 to 2)) {
|
||||
api.getUserByName("johnny-" + i) match {
|
||||
case Some(user) => {
|
||||
user.id should be(2000 + i)
|
||||
user.email should be("johnny-" + i + "@fail.com")
|
||||
user.id should be(Some(2000 + i))
|
||||
user.email should be(Some("johnny-" + i + "@fail.com"))
|
||||
}
|
||||
case None => fail("didn't find user " + i)
|
||||
}
|
||||
@@ -94,22 +94,22 @@ class UserApiTest extends FlatSpec with Matchers with BeforeAndAfterAll {
|
||||
it should "create 3 users" in {
|
||||
val userList = (for (i <- (1 to 3)) yield {
|
||||
User(
|
||||
3000 + i,
|
||||
"fred-" + i,
|
||||
"Johnny",
|
||||
"Rocket-" + i,
|
||||
"fred-" + i + "@fail.com",
|
||||
"XXXXXXXXXXX",
|
||||
"408-867-5309",
|
||||
1)
|
||||
Some(3000 + i),
|
||||
Some("fred-" + i),
|
||||
Some("Johnny"),
|
||||
Some("Rocket-" + i),
|
||||
Some("fred-" + i + "@fail.com"),
|
||||
Some("XXXXXXXXXXX"),
|
||||
Some("408-867-5309"),
|
||||
Some(1))
|
||||
}).toList
|
||||
api.createUsersWithListInput(userList)
|
||||
|
||||
for (i <- (1 to 3)) {
|
||||
api.getUserByName("fred-" + i) match {
|
||||
case Some(user) => {
|
||||
user.id should be(3000 + i)
|
||||
user.email should be("fred-" + i + "@fail.com")
|
||||
user.id should be(Some(3000 + i))
|
||||
user.email should be(Some("fred-" + i + "@fail.com"))
|
||||
}
|
||||
case None => fail("didn't find user " + i)
|
||||
}
|
||||
@@ -118,31 +118,31 @@ class UserApiTest extends FlatSpec with Matchers with BeforeAndAfterAll {
|
||||
|
||||
it should "update a user" in {
|
||||
val user = User(
|
||||
4000,
|
||||
"tony",
|
||||
"Tony",
|
||||
"Tiger",
|
||||
"tony@fail.com",
|
||||
"XXXXXXXXXXX",
|
||||
"408-867-5309",
|
||||
1)
|
||||
Some(4000),
|
||||
Some("tony"),
|
||||
Some("Tony"),
|
||||
Some("Tiger"),
|
||||
Some("tony@fail.com"),
|
||||
Some("XXXXXXXXXXX"),
|
||||
Some("408-867-5309"),
|
||||
Some(1))
|
||||
|
||||
api.createUser(user)
|
||||
|
||||
api.getUserByName("tony") match {
|
||||
case Some(user) => {
|
||||
user.id should be(4000)
|
||||
user.username should be("tony")
|
||||
user.id should be(Some(4000))
|
||||
user.username should be(Some("tony"))
|
||||
}
|
||||
case None =>
|
||||
}
|
||||
|
||||
val updatedUser = user.copy(email = "tony@succeed.com")
|
||||
val updatedUser = user.copy(email = Some("tony@succeed.com"))
|
||||
|
||||
api.updateUser("tony", updatedUser)
|
||||
api.getUserByName("tony") match {
|
||||
case Some(user) => {
|
||||
user.email should be("tony@succeed.com")
|
||||
user.email should be(Some("tony@succeed.com"))
|
||||
}
|
||||
case None =>
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -81,7 +81,7 @@
|
||||
<java.version>1.7</java.version>
|
||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||
<swagger-core-version>1.5.9</swagger-core-version>
|
||||
<swagger-core-version>1.5.12</swagger-core-version>
|
||||
<jetty-version>9.2.9.v20150224</jetty-version>
|
||||
<jersey2-version>2.22.2</jersey2-version>
|
||||
<junit-version>4.12</junit-version>
|
||||
|
||||
@@ -7,9 +7,9 @@ import io.swagger.api.factories.FakeApiServiceFactory;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import io.swagger.jaxrs.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import io.swagger.model.Client;
|
||||
import java.util.Date;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import java.util.List;
|
||||
import io.swagger.api.NotFoundException;
|
||||
@@ -36,7 +36,7 @@ public class FakeApi {
|
||||
|
||||
@Consumes({ "application/json" })
|
||||
@Produces({ "application/json" })
|
||||
@io.swagger.annotations.ApiOperation(value = "To test \"client\" model", notes = "", response = Client.class, tags={ "fake", })
|
||||
@io.swagger.annotations.ApiOperation(value = "To test \"client\" model", notes = "To test \"client\" model", response = Client.class, tags={ "fake", })
|
||||
@io.swagger.annotations.ApiResponses(value = {
|
||||
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Client.class) })
|
||||
public Response testClientModel(@ApiParam(value = "client model" ,required=true) Client body
|
||||
@@ -75,9 +75,9 @@ public class FakeApi {
|
||||
}
|
||||
@GET
|
||||
|
||||
@Consumes({ "application/json" })
|
||||
@Produces({ "application/json" })
|
||||
@io.swagger.annotations.ApiOperation(value = "To test enum parameters", notes = "", response = void.class, tags={ "fake", })
|
||||
@Consumes({ "*/*" })
|
||||
@Produces({ "*/*" })
|
||||
@io.swagger.annotations.ApiOperation(value = "To test enum parameters", notes = "To test enum parameters", response = void.class, tags={ "fake", })
|
||||
@io.swagger.annotations.ApiResponses(value = {
|
||||
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid request", response = void.class),
|
||||
|
||||
@@ -88,7 +88,7 @@ public class FakeApi {
|
||||
,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg")@HeaderParam("enum_header_string") String enumHeaderString
|
||||
,@ApiParam(value = "Query parameter enum test (string array)", allowableValues=">, $") @QueryParam("enum_query_string_array") List<String> enumQueryStringArray
|
||||
,@ApiParam(value = "Query parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @DefaultValue("-efg") @QueryParam("enum_query_string") String enumQueryString
|
||||
,@ApiParam(value = "Query parameter enum test (double)") @QueryParam("enum_query_integer") BigDecimal enumQueryInteger
|
||||
,@ApiParam(value = "Query parameter enum test (double)") @QueryParam("enum_query_integer") Integer enumQueryInteger
|
||||
,@ApiParam(value = "Query parameter enum test (double)") @FormParam("enum_query_double") Double enumQueryDouble
|
||||
)
|
||||
throws NotFoundException {
|
||||
|
||||
@@ -6,9 +6,9 @@ import io.swagger.model.*;
|
||||
import org.wso2.msf4j.formparam.FormDataParam;
|
||||
import org.wso2.msf4j.formparam.FileInfo;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import io.swagger.model.Client;
|
||||
import java.util.Date;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import java.util.List;
|
||||
import io.swagger.api.NotFoundException;
|
||||
@@ -43,7 +43,7 @@ public abstract class FakeApiService {
|
||||
,String enumHeaderString
|
||||
,List<String> enumQueryStringArray
|
||||
,String enumQueryString
|
||||
,BigDecimal enumQueryInteger
|
||||
,Integer enumQueryInteger
|
||||
,Double enumQueryDouble
|
||||
) throws NotFoundException;
|
||||
}
|
||||
|
||||
@@ -7,9 +7,9 @@ import io.swagger.api.factories.PetApiServiceFactory;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import io.swagger.jaxrs.*;
|
||||
|
||||
import io.swagger.model.Pet;
|
||||
import java.io.File;
|
||||
import io.swagger.model.ModelApiResponse;
|
||||
import io.swagger.model.Pet;
|
||||
|
||||
import java.util.List;
|
||||
import io.swagger.api.NotFoundException;
|
||||
|
||||
@@ -6,9 +6,9 @@ import io.swagger.model.*;
|
||||
import org.wso2.msf4j.formparam.FormDataParam;
|
||||
import org.wso2.msf4j.formparam.FileInfo;
|
||||
|
||||
import io.swagger.model.Pet;
|
||||
import java.io.File;
|
||||
import io.swagger.model.ModelApiResponse;
|
||||
import io.swagger.model.Pet;
|
||||
|
||||
import java.util.List;
|
||||
import io.swagger.api.NotFoundException;
|
||||
|
||||
@@ -7,8 +7,8 @@ import io.swagger.api.factories.UserApiServiceFactory;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import io.swagger.jaxrs.*;
|
||||
|
||||
import io.swagger.model.User;
|
||||
import java.util.List;
|
||||
import io.swagger.model.User;
|
||||
|
||||
import java.util.List;
|
||||
import io.swagger.api.NotFoundException;
|
||||
|
||||
@@ -6,8 +6,8 @@ import io.swagger.model.*;
|
||||
import org.wso2.msf4j.formparam.FormDataParam;
|
||||
import org.wso2.msf4j.formparam.FileInfo;
|
||||
|
||||
import io.swagger.model.User;
|
||||
import java.util.List;
|
||||
import io.swagger.model.User;
|
||||
|
||||
import java.util.List;
|
||||
import io.swagger.api.NotFoundException;
|
||||
|
||||
@@ -3,6 +3,8 @@ package io.swagger.model;
|
||||
import java.util.Objects;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonSubTypes;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
|
||||
@@ -0,0 +1,189 @@
|
||||
package io.swagger.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
/**
|
||||
* Capitalization
|
||||
*/
|
||||
|
||||
public class Capitalization {
|
||||
@JsonProperty("smallCamel")
|
||||
private String smallCamel = null;
|
||||
|
||||
@JsonProperty("CapitalCamel")
|
||||
private String capitalCamel = null;
|
||||
|
||||
@JsonProperty("small_Snake")
|
||||
private String smallSnake = null;
|
||||
|
||||
@JsonProperty("Capital_Snake")
|
||||
private String capitalSnake = null;
|
||||
|
||||
@JsonProperty("SCA_ETH_Flow_Points")
|
||||
private String scAETHFlowPoints = null;
|
||||
|
||||
@JsonProperty("ATT_NAME")
|
||||
private String ATT_NAME = null;
|
||||
|
||||
public Capitalization smallCamel(String smallCamel) {
|
||||
this.smallCamel = smallCamel;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get smallCamel
|
||||
* @return smallCamel
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
public String getSmallCamel() {
|
||||
return smallCamel;
|
||||
}
|
||||
|
||||
public void setSmallCamel(String smallCamel) {
|
||||
this.smallCamel = smallCamel;
|
||||
}
|
||||
|
||||
public Capitalization capitalCamel(String capitalCamel) {
|
||||
this.capitalCamel = capitalCamel;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get capitalCamel
|
||||
* @return capitalCamel
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
public String getCapitalCamel() {
|
||||
return capitalCamel;
|
||||
}
|
||||
|
||||
public void setCapitalCamel(String capitalCamel) {
|
||||
this.capitalCamel = capitalCamel;
|
||||
}
|
||||
|
||||
public Capitalization smallSnake(String smallSnake) {
|
||||
this.smallSnake = smallSnake;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get smallSnake
|
||||
* @return smallSnake
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
public String getSmallSnake() {
|
||||
return smallSnake;
|
||||
}
|
||||
|
||||
public void setSmallSnake(String smallSnake) {
|
||||
this.smallSnake = smallSnake;
|
||||
}
|
||||
|
||||
public Capitalization capitalSnake(String capitalSnake) {
|
||||
this.capitalSnake = capitalSnake;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get capitalSnake
|
||||
* @return capitalSnake
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
public String getCapitalSnake() {
|
||||
return capitalSnake;
|
||||
}
|
||||
|
||||
public void setCapitalSnake(String capitalSnake) {
|
||||
this.capitalSnake = capitalSnake;
|
||||
}
|
||||
|
||||
public Capitalization scAETHFlowPoints(String scAETHFlowPoints) {
|
||||
this.scAETHFlowPoints = scAETHFlowPoints;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get scAETHFlowPoints
|
||||
* @return scAETHFlowPoints
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
public String getScAETHFlowPoints() {
|
||||
return scAETHFlowPoints;
|
||||
}
|
||||
|
||||
public void setScAETHFlowPoints(String scAETHFlowPoints) {
|
||||
this.scAETHFlowPoints = scAETHFlowPoints;
|
||||
}
|
||||
|
||||
public Capitalization ATT_NAME(String ATT_NAME) {
|
||||
this.ATT_NAME = ATT_NAME;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Name of the pet
|
||||
* @return ATT_NAME
|
||||
**/
|
||||
@ApiModelProperty(value = "Name of the pet ")
|
||||
public String getATTNAME() {
|
||||
return ATT_NAME;
|
||||
}
|
||||
|
||||
public void setATTNAME(String ATT_NAME) {
|
||||
this.ATT_NAME = ATT_NAME;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(java.lang.Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
Capitalization capitalization = (Capitalization) o;
|
||||
return Objects.equals(this.smallCamel, capitalization.smallCamel) &&
|
||||
Objects.equals(this.capitalCamel, capitalization.capitalCamel) &&
|
||||
Objects.equals(this.smallSnake, capitalization.smallSnake) &&
|
||||
Objects.equals(this.capitalSnake, capitalization.capitalSnake) &&
|
||||
Objects.equals(this.scAETHFlowPoints, capitalization.scAETHFlowPoints) &&
|
||||
Objects.equals(this.ATT_NAME, capitalization.ATT_NAME);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(smallCamel, capitalCamel, smallSnake, capitalSnake, scAETHFlowPoints, ATT_NAME);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class Capitalization {\n");
|
||||
|
||||
sb.append(" smallCamel: ").append(toIndentedString(smallCamel)).append("\n");
|
||||
sb.append(" capitalCamel: ").append(toIndentedString(capitalCamel)).append("\n");
|
||||
sb.append(" smallSnake: ").append(toIndentedString(smallSnake)).append("\n");
|
||||
sb.append(" capitalSnake: ").append(toIndentedString(capitalSnake)).append("\n");
|
||||
sb.append(" scAETHFlowPoints: ").append(toIndentedString(scAETHFlowPoints)).append("\n");
|
||||
sb.append(" ATT_NAME: ").append(toIndentedString(ATT_NAME)).append("\n");
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given object to string with each line indented by 4 spaces
|
||||
* (except the first line).
|
||||
*/
|
||||
private String toIndentedString(java.lang.Object o) {
|
||||
if (o == null) {
|
||||
return "null";
|
||||
}
|
||||
return o.toString().replace("\n", "\n ");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
package io.swagger.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
/**
|
||||
* Model for testing model with \"_class\" property
|
||||
*/
|
||||
@ApiModel(description = "Model for testing model with \"_class\" property")
|
||||
|
||||
public class ClassModel {
|
||||
@JsonProperty("_class")
|
||||
private String propertyClass = null;
|
||||
|
||||
public ClassModel propertyClass(String propertyClass) {
|
||||
this.propertyClass = propertyClass;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get propertyClass
|
||||
* @return propertyClass
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
public String getPropertyClass() {
|
||||
return propertyClass;
|
||||
}
|
||||
|
||||
public void setPropertyClass(String propertyClass) {
|
||||
this.propertyClass = propertyClass;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(java.lang.Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
ClassModel classModel = (ClassModel) o;
|
||||
return Objects.equals(this.propertyClass, classModel.propertyClass);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(propertyClass);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class ClassModel {\n");
|
||||
|
||||
sb.append(" propertyClass: ").append(toIndentedString(propertyClass)).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(java.lang.Object o) {
|
||||
if (o == null) {
|
||||
return "null";
|
||||
}
|
||||
return o.toString().replace("\n", "\n ");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.model.OuterEnum;
|
||||
|
||||
/**
|
||||
* EnumTest
|
||||
@@ -116,6 +117,9 @@ public class EnumTest {
|
||||
@JsonProperty("enum_number")
|
||||
private EnumNumberEnum enumNumber = null;
|
||||
|
||||
@JsonProperty("outerEnum")
|
||||
private OuterEnum outerEnum = null;
|
||||
|
||||
public EnumTest enumString(EnumStringEnum enumString) {
|
||||
this.enumString = enumString;
|
||||
return this;
|
||||
@@ -170,6 +174,24 @@ public class EnumTest {
|
||||
this.enumNumber = enumNumber;
|
||||
}
|
||||
|
||||
public EnumTest outerEnum(OuterEnum outerEnum) {
|
||||
this.outerEnum = outerEnum;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get outerEnum
|
||||
* @return outerEnum
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
public OuterEnum getOuterEnum() {
|
||||
return outerEnum;
|
||||
}
|
||||
|
||||
public void setOuterEnum(OuterEnum outerEnum) {
|
||||
this.outerEnum = outerEnum;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(java.lang.Object o) {
|
||||
@@ -182,12 +204,13 @@ public class EnumTest {
|
||||
EnumTest enumTest = (EnumTest) o;
|
||||
return Objects.equals(this.enumString, enumTest.enumString) &&
|
||||
Objects.equals(this.enumInteger, enumTest.enumInteger) &&
|
||||
Objects.equals(this.enumNumber, enumTest.enumNumber);
|
||||
Objects.equals(this.enumNumber, enumTest.enumNumber) &&
|
||||
Objects.equals(this.outerEnum, enumTest.outerEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(enumString, enumInteger, enumNumber);
|
||||
return Objects.hash(enumString, enumInteger, enumNumber, outerEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -198,6 +221,7 @@ public class EnumTest {
|
||||
sb.append(" enumString: ").append(toIndentedString(enumString)).append("\n");
|
||||
sb.append(" enumInteger: ").append(toIndentedString(enumInteger)).append("\n");
|
||||
sb.append(" enumNumber: ").append(toIndentedString(enumNumber)).append("\n");
|
||||
sb.append(" outerEnum: ").append(toIndentedString(outerEnum)).append("\n");
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* FormatTest
|
||||
@@ -47,7 +48,7 @@ public class FormatTest {
|
||||
private Date dateTime = null;
|
||||
|
||||
@JsonProperty("uuid")
|
||||
private String uuid = null;
|
||||
private UUID uuid = null;
|
||||
|
||||
@JsonProperty("password")
|
||||
private String password = null;
|
||||
@@ -59,8 +60,8 @@ public class FormatTest {
|
||||
|
||||
/**
|
||||
* Get integer
|
||||
* minimum: 10.0
|
||||
* maximum: 100.0
|
||||
* minimum: 10
|
||||
* maximum: 100
|
||||
* @return integer
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
@@ -79,8 +80,8 @@ public class FormatTest {
|
||||
|
||||
/**
|
||||
* Get int32
|
||||
* minimum: 20.0
|
||||
* maximum: 200.0
|
||||
* minimum: 20
|
||||
* maximum: 200
|
||||
* @return int32
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
@@ -260,7 +261,7 @@ public class FormatTest {
|
||||
this.dateTime = dateTime;
|
||||
}
|
||||
|
||||
public FormatTest uuid(String uuid) {
|
||||
public FormatTest uuid(UUID uuid) {
|
||||
this.uuid = uuid;
|
||||
return this;
|
||||
}
|
||||
@@ -270,11 +271,11 @@ public class FormatTest {
|
||||
* @return uuid
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
public String getUuid() {
|
||||
public UUID getUuid() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
public void setUuid(String uuid) {
|
||||
public void setUuid(UUID uuid) {
|
||||
this.uuid = uuid;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* MixedPropertiesAndAdditionalPropertiesClass
|
||||
@@ -17,7 +18,7 @@ import java.util.Map;
|
||||
|
||||
public class MixedPropertiesAndAdditionalPropertiesClass {
|
||||
@JsonProperty("uuid")
|
||||
private String uuid = null;
|
||||
private UUID uuid = null;
|
||||
|
||||
@JsonProperty("dateTime")
|
||||
private Date dateTime = null;
|
||||
@@ -25,7 +26,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass {
|
||||
@JsonProperty("map")
|
||||
private Map<String, Animal> map = new HashMap<String, Animal>();
|
||||
|
||||
public MixedPropertiesAndAdditionalPropertiesClass uuid(String uuid) {
|
||||
public MixedPropertiesAndAdditionalPropertiesClass uuid(UUID uuid) {
|
||||
this.uuid = uuid;
|
||||
return this;
|
||||
}
|
||||
@@ -35,11 +36,11 @@ public class MixedPropertiesAndAdditionalPropertiesClass {
|
||||
* @return uuid
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
public String getUuid() {
|
||||
public UUID getUuid() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
public void setUuid(String uuid) {
|
||||
public void setUuid(UUID uuid) {
|
||||
this.uuid = uuid;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
package io.swagger.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
|
||||
/**
|
||||
* Gets or Sets OuterEnum
|
||||
*/
|
||||
public enum OuterEnum {
|
||||
|
||||
PLACED("placed"),
|
||||
|
||||
APPROVED("approved"),
|
||||
|
||||
DELIVERED("delivered");
|
||||
|
||||
private String value;
|
||||
|
||||
OuterEnum(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
||||
@JsonCreator
|
||||
public static OuterEnum fromValue(String text) {
|
||||
for (OuterEnum b : OuterEnum.values()) {
|
||||
if (String.valueOf(b.value).equals(text)) {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,9 +3,9 @@ package io.swagger.api.impl;
|
||||
import io.swagger.api.*;
|
||||
import io.swagger.model.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import io.swagger.model.Client;
|
||||
import java.util.Date;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import java.util.List;
|
||||
import io.swagger.api.NotFoundException;
|
||||
@@ -52,7 +52,7 @@ public class FakeApiServiceImpl extends FakeApiService {
|
||||
, String enumHeaderString
|
||||
, List<String> enumQueryStringArray
|
||||
, String enumQueryString
|
||||
, BigDecimal enumQueryInteger
|
||||
, Integer enumQueryInteger
|
||||
, Double enumQueryDouble
|
||||
) throws NotFoundException {
|
||||
// do some magic!
|
||||
|
||||
@@ -3,9 +3,9 @@ package io.swagger.api.impl;
|
||||
import io.swagger.api.*;
|
||||
import io.swagger.model.*;
|
||||
|
||||
import io.swagger.model.Pet;
|
||||
import java.io.File;
|
||||
import io.swagger.model.ModelApiResponse;
|
||||
import io.swagger.model.Pet;
|
||||
|
||||
import java.util.List;
|
||||
import io.swagger.api.NotFoundException;
|
||||
|
||||
@@ -3,8 +3,8 @@ package io.swagger.api.impl;
|
||||
import io.swagger.api.*;
|
||||
import io.swagger.model.*;
|
||||
|
||||
import io.swagger.model.User;
|
||||
import java.util.List;
|
||||
import io.swagger.model.User;
|
||||
|
||||
import java.util.List;
|
||||
import io.swagger.api.NotFoundException;
|
||||
|
||||
@@ -112,6 +112,13 @@
|
||||
<version>${junit-version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<!-- Bean Validation API support -->
|
||||
<dependency>
|
||||
<groupId>javax.validation</groupId>
|
||||
<artifactId>validation-api</artifactId>
|
||||
<version>${beanvalidation-version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- CXF Client -->
|
||||
<dependency>
|
||||
<groupId>org.apache.cxf</groupId>
|
||||
@@ -151,6 +158,18 @@
|
||||
<version>${cxf-version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.jaxrs</groupId>
|
||||
<artifactId>jackson-jaxrs-json-provider</artifactId>
|
||||
<version>${jackson-jaxrs-version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||
<artifactId>jackson-datatype-joda</artifactId>
|
||||
<version>${jackson-jaxrs-version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<repositories>
|
||||
<repository>
|
||||
@@ -165,13 +184,15 @@
|
||||
<java.version>1.7</java.version>
|
||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||
<swagger-core-version>1.5.10</swagger-core-version>
|
||||
<swagger-core-version>1.5.12</swagger-core-version>
|
||||
<jetty-version>9.2.9.v20150224</jetty-version>
|
||||
<jersey2-version>2.22.2</jersey2-version>
|
||||
<junit-version>4.12</junit-version>
|
||||
<logback-version>1.1.7</logback-version>
|
||||
<servlet-api-version>2.5</servlet-api-version>
|
||||
<beanvalidation-version>1.1.0.Final</beanvalidation-version>
|
||||
<cxf-version>3.1.8</cxf-version>
|
||||
<jackson-jaxrs-version>2.8.4</jackson-jaxrs-version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
</project>
|
||||
|
||||
@@ -63,7 +63,7 @@ class PetApi (implicit val swagger: Swagger) extends ScalatraServlet
|
||||
parameters(pathParam[Long]("petId").description(""), headerParam[String]("apiKey").description("").optional)
|
||||
)
|
||||
|
||||
delete("/pet/{petId}",operation(deletePetOperation)) {
|
||||
delete("/pet/:petId",operation(deletePetOperation)) {
|
||||
|
||||
|
||||
val petId = params.getOrElse("petId", halt(400))
|
||||
@@ -131,7 +131,7 @@ class PetApi (implicit val swagger: Swagger) extends ScalatraServlet
|
||||
parameters(pathParam[Long]("petId").description(""))
|
||||
)
|
||||
|
||||
get("/pet/{petId}",operation(getPetByIdOperation)) {
|
||||
get("/pet/:petId",operation(getPetByIdOperation)) {
|
||||
|
||||
|
||||
val petId = params.getOrElse("petId", halt(400))
|
||||
@@ -161,7 +161,7 @@ class PetApi (implicit val swagger: Swagger) extends ScalatraServlet
|
||||
parameters(pathParam[Long]("petId").description(""), formParam[String]("name").description("").optional, formParam[String]("status").description("").optional)
|
||||
)
|
||||
|
||||
post("/pet/{petId}",operation(updatePetWithFormOperation)) {
|
||||
post("/pet/:petId",operation(updatePetWithFormOperation)) {
|
||||
|
||||
|
||||
val petId = params.getOrElse("petId", halt(400))
|
||||
@@ -186,7 +186,7 @@ class PetApi (implicit val swagger: Swagger) extends ScalatraServlet
|
||||
parameters(pathParam[Long]("petId").description(""), formParam[String]("additionalMetadata").description("").optional, formParam[File]("file").description("").optional)
|
||||
)
|
||||
|
||||
post("/pet/{petId}/uploadImage",operation(uploadFileOperation)) {
|
||||
post("/pet/:petId/uploadImage",operation(uploadFileOperation)) {
|
||||
|
||||
|
||||
val petId = params.getOrElse("petId", halt(400))
|
||||
|
||||
@@ -46,7 +46,7 @@ class StoreApi (implicit val swagger: Swagger) extends ScalatraServlet
|
||||
parameters(pathParam[String]("orderId").description(""))
|
||||
)
|
||||
|
||||
delete("/store/order/{orderId}",operation(deleteOrderOperation)) {
|
||||
delete("/store/order/:orderId",operation(deleteOrderOperation)) {
|
||||
|
||||
|
||||
val orderId = params.getOrElse("orderId", halt(400))
|
||||
@@ -71,7 +71,7 @@ class StoreApi (implicit val swagger: Swagger) extends ScalatraServlet
|
||||
parameters(pathParam[Long]("orderId").description(""))
|
||||
)
|
||||
|
||||
get("/store/order/{orderId}",operation(getOrderByIdOperation)) {
|
||||
get("/store/order/:orderId",operation(getOrderByIdOperation)) {
|
||||
|
||||
|
||||
val orderId = params.getOrElse("orderId", halt(400))
|
||||
|
||||
@@ -93,6 +93,7 @@ class UserApi (implicit val swagger: Swagger) extends ScalatraServlet
|
||||
|
||||
delete("/user/:username",operation(deleteUserOperation)) {
|
||||
|
||||
|
||||
val username = params.getOrElse("username", halt(400))
|
||||
|
||||
println("username: " + username)
|
||||
@@ -107,6 +108,7 @@ class UserApi (implicit val swagger: Swagger) extends ScalatraServlet
|
||||
|
||||
get("/user/:username",operation(getUserByNameOperation)) {
|
||||
|
||||
|
||||
val username = params.getOrElse("username", halt(400))
|
||||
|
||||
println("username: " + username)
|
||||
@@ -151,6 +153,7 @@ class UserApi (implicit val swagger: Swagger) extends ScalatraServlet
|
||||
|
||||
put("/user/:username",operation(updateUserOperation)) {
|
||||
|
||||
|
||||
val username = params.getOrElse("username", halt(400))
|
||||
|
||||
println("username: " + username)
|
||||
|
||||
Reference in New Issue
Block a user