diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index e0b6576bf95..2d56048159f 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -34,6 +34,8 @@ Code change should conform to the programming style guide of the respective lang
- C#: https://msdn.microsoft.com/en-us/library/vstudio/ff926074.aspx
- C++: https://google.github.io/styleguide/cppguide.html
- Clojure: https://github.com/bbatsov/clojure-style-guide
+- Elixir: https://github.com/christopheradams/elixir_style_guide
+- Erlang: https://github.com/inaka/erlang_guidelines
- Haskell: https://github.com/tibbe/haskell-style-guide/blob/master/haskell-style.md
- Java: https://google.github.io/styleguide/javaguide.html
- JavaScript: https://github.com/airbnb/javascript/
diff --git a/README.md b/README.md
index 8c3bad5a30c..88d7e54ce61 100644
--- a/README.md
+++ b/README.md
@@ -838,7 +838,7 @@ Here are some companies/projects using Swagger Codegen in production. To add you
- [carpolo](http://www.carpolo.co/)
- [CloudBoost](https://www.CloudBoost.io/)
- [Conplement](http://www.conplement.de/)
-- [Cummins] (http://www.cummins.com/)
+- [Cummins](http://www.cummins.com/)
- [Cupix](http://www.cupix.com)
- [DBBest Technologies](https://www.dbbest.com)
- [DecentFoX](http://decentfox.com/)
diff --git a/bin/akka-scala-petstore.sh b/bin/akka-scala-petstore.sh
index 0fc8dafd2d7..3340758f9ed 100755
--- a/bin/akka-scala-petstore.sh
+++ b/bin/akka-scala-petstore.sh
@@ -26,6 +26,6 @@ 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/akka-scala -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l akka-scala -o samples/client/petstore/akka-scala"
+ags="$@ generate --artifact-id "scala-akka-petstore-client" -t modules/swagger-codegen/src/main/resources/akka-scala -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l akka-scala -o samples/client/petstore/akka-scala"
java $JAVA_OPTS -jar $executable $ags
diff --git a/bin/jaxrs-cxf-client-petstore.sh b/bin/jaxrs-cxf-client-petstore.sh
new file mode 100755
index 00000000000..a0d30ea29ff
--- /dev/null
+++ b/bin/jaxrs-cxf-client-petstore.sh
@@ -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 --artifact-id "jaxrs-cxf-petstore-client" -t modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/ -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l jaxrs-cxf -o samples/client/petstore/jaxrs-cxf-client/"
+
+java $JAVA_OPTS -jar $executable $ags
diff --git a/bin/spring-delegate-j8.sh b/bin/spring-delegate-j8.sh
index 5585caa6b8b..43e109836ef 100755
--- a/bin/spring-delegate-j8.sh
+++ b/bin/spring-delegate-j8.sh
@@ -30,5 +30,5 @@ ags="$@ generate -t modules/swagger-codegen/src/main/resources/JavaSpring -i mod
echo "Removing files and folders under samples/server/petstore/springboot-delegate-j8/src/main"
rm -rf samples/server/petstore/springboot-delegate-j8/src/main
-find samples/server/petstore/springboot -maxdepth 1 -type f ! -name "README.md" -exec rm {} +
+find samples/server/petstore/springboot-delegate-j8/ -maxdepth 1 -type f ! -name "README.md" -exec rm {} +
java $JAVA_OPTS -jar $executable $ags
diff --git a/bin/spring-delegate.sh b/bin/spring-delegate.sh
index 1e523501cd9..33ac11b9d81 100755
--- a/bin/spring-delegate.sh
+++ b/bin/spring-delegate.sh
@@ -30,5 +30,5 @@ ags="$@ generate -t modules/swagger-codegen/src/main/resources/JavaSpring -i mod
echo "Removing files and folders under samples/server/petstore/springboot-delegate/src/main"
rm -rf samples/server/petstore/springboot-delegate/src/main
-find samples/server/petstore/springboot -maxdepth 1 -type f ! -name "README.md" -exec rm {} +
+find samples/server/petstore/springboot-delegate/ -maxdepth 1 -type f ! -name "README.md" -exec rm {} +
java $JAVA_OPTS -jar $executable $ags
diff --git a/bin/windows/akka-scala-petstore.bat b/bin/windows/akka-scala-petstore.bat
index 27598a00a4b..86ec1ef6eff 100755
--- a/bin/windows/akka-scala-petstore.bat
+++ b/bin/windows/akka-scala-petstore.bat
@@ -5,6 +5,6 @@ If Not Exist %executable% (
)
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties
-set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l akka-scala -o samples\client\petstore\akka-scala
+set ags=generate --artifact-id "scala-akka-petstore-client" -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l akka-scala -o samples\client\petstore\akka-scala
java %JAVA_OPTS% -jar %executable% %ags%
diff --git a/bin/windows/jaxrs-cxf-client-petstore.bat b/bin/windows/jaxrs-cxf-client-petstore.bat
new file mode 100755
index 00000000000..fdb4d6ff69a
--- /dev/null
+++ b/bin/windows/jaxrs-cxf-client-petstore.bat
@@ -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 -DloggerPath=conf/log4j.properties
+set ags=generate --artifact-id "jaxrs-cxf-client-petstore-client" -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l jaxrs-cxf-client -o samples\client\petstore\jaxrs-cxf-client
+
+java %JAVA_OPTS% -jar %executable% %ags%
diff --git a/modules/swagger-codegen-maven-plugin/README.md b/modules/swagger-codegen-maven-plugin/README.md
index 64382be8678..0b71c64b68f 100644
--- a/modules/swagger-codegen-maven-plugin/README.md
+++ b/modules/swagger-codegen-maven-plugin/README.md
@@ -50,6 +50,15 @@ mvn clean compile
- `configOptions` - a map of language-specific parameters (see below)
- `configHelp` - dumps the configuration help for the specified library (generates no sources)
- `ignoreFileOverride` - specifies the full path to a `.swagger-codegen-ignore` used for pattern based overrides of generated outputs
+- `generateApis` - generate the apis (`true` by default)
+- `generateApiTests` - generate the api tests (`true` by default. Only available if `generateApis` is `true`)
+- `generateApiDocumentation` - generate the api documentation (`true` by default. Only available if `generateApis` is `true`)
+- `generateModels` - generate the models (`true` by default)
+- `modelsToGenerate` - A comma separated list of models to generate. All models is the default.
+- `generateModelTests` - generate the model tests (`true` by default. Only available if `generateModels` is `true`)
+- `generateModelDocumentation` - generate the model documentation (`true` by default. Only available if `generateModels` is `true`)
+- `generateSupportingFiles` - generate the supporting files (`true` by default)
+- `supportingFilesToGenerate` - A comma separated list of supporting files to generate. All files is the default.
### Custom Generator
diff --git a/modules/swagger-codegen-maven-plugin/src/main/java/io/swagger/codegen/plugin/CodeGenMojo.java b/modules/swagger-codegen-maven-plugin/src/main/java/io/swagger/codegen/plugin/CodeGenMojo.java
index 613c2b9186f..15d3b4a86da 100644
--- a/modules/swagger-codegen-maven-plugin/src/main/java/io/swagger/codegen/plugin/CodeGenMojo.java
+++ b/modules/swagger-codegen-maven-plugin/src/main/java/io/swagger/codegen/plugin/CodeGenMojo.java
@@ -174,6 +174,62 @@ public class CodeGenMojo extends AbstractMojo {
@Parameter(name = "configOptions")
private Map, ?> configOptions;
+ /**
+ * Generate the apis
+ */
+ @Parameter(name = "generateApis", required = false)
+ private Boolean generateApis = true;
+
+ /**
+ * Generate the models
+ */
+ @Parameter(name = "generateModels", required = false)
+ private Boolean generateModels = true;
+
+ /**
+ * A comma separated list of models to generate. All models is the default.
+ */
+ @Parameter(name = "modelsToGenerate", required = false)
+ private String modelsToGenerate = "";
+
+ /**
+ * Generate the supporting files
+ */
+ @Parameter(name = "generateSupportingFiles", required = false)
+ private Boolean generateSupportingFiles = true;
+
+ /**
+ * A comma separated list of models to generate. All models is the default.
+ */
+ @Parameter(name = "supportingFilesToGenerate", required = false)
+ private String supportingFilesToGenerate = "";
+
+ /**
+ * Generate the model tests
+ */
+ @Parameter(name = "generateModelTests", required = false)
+ private Boolean generateModelTests = true;
+
+ /**
+ * Generate the model documentation
+ */
+ @Parameter(name = "generateModelDocumentation", required = false)
+ private Boolean generateModelDocumentation = true;
+
+ /**
+ * Generate the api tests
+ */
+ @Parameter(name = "generateApiTests", required = false)
+ private Boolean generateApiTests = true;
+
+ /**
+ * Generate the api documentation
+ */
+ @Parameter(name = "generateApiDocumentation", required = false)
+ private Boolean generateApiDocumentation = true;
+
+
+
/**
* Add the output directory to the project as a source root, so that the
* generated java types are compiled and included in the project artifact.
@@ -274,6 +330,23 @@ public void execute() throws MojoExecutionException {
configurator.setTemplateDir(templateDirectory.getAbsolutePath());
}
+ // Set generation options
+ if (null != generateApis && generateApis) {
+ System.setProperty("apis", "");
+ }
+ if (null != generateModels && generateModels) {
+ System.setProperty("models", modelsToGenerate);
+ }
+
+ if (null != generateSupportingFiles && generateSupportingFiles) {
+ System.setProperty("supportingFiles", supportingFilesToGenerate);
+ }
+
+ System.setProperty("modelTests", generateModelTests.toString());
+ System.setProperty("modelDocs", generateModelDocumentation.toString());
+ System.setProperty("apiTests", generateApiTests.toString());
+ System.setProperty("apiDocs", generateApiDocumentation.toString());
+
if (configOptions != null) {
if(configOptions.containsKey("instantiation-types")) {
diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/HaskellServantCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/HaskellServantCodegen.java
index 96a8a7bb926..b7a2462ab23 100644
--- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/HaskellServantCodegen.java
+++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/HaskellServantCodegen.java
@@ -54,6 +54,12 @@ public HaskellServantCodegen() {
specialCharReplacements.put(">", "GreaterThan");
specialCharReplacements.put("<", "LessThan");
+ // backslash and double quote need double the escapement for both Java and Haskell
+ specialCharReplacements.remove("\\");
+ specialCharReplacements.remove("\"");
+ specialCharReplacements.put("\\\\", "Back_Slash");
+ specialCharReplacements.put("\\\"", "Double_Quote");
+
// set the output folder here
outputFolder = "generated-code/haskell-servant";
diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaClientCodegen.java
index b8d24109f04..3b8cea940a1 100644
--- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaClientCodegen.java
+++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaClientCodegen.java
@@ -60,7 +60,7 @@ public JavaClientCodegen() {
cliOptions.add(CliOption.newBoolean(USE_GZIP_FEATURE, "Send gzip-encoded requests"));
supportedLibraries.put("jersey1", "HTTP client: Jersey client 1.19.1. JSON processing: Jackson 2.7.0. Enable Java6 support using '-DsupportJava6=true'. Enable gzip request encoding using '-DuseGzipFeature=true'.");
- supportedLibraries.put("feign", "HTTP client: Netflix Feign 8.16.0. JSON processing: Jackson 2.7.0");
+ supportedLibraries.put("feign", "HTTP client: OpenFeign 9.4.0. JSON processing: Jackson 2.8.7");
supportedLibraries.put("jersey2", "HTTP client: Jersey client 2.22.2. JSON processing: Jackson 2.7.0");
supportedLibraries.put("okhttp-gson", "HTTP client: OkHttp 2.7.5. JSON processing: Gson 2.6.2. Enable Parcelable modles on Android using '-DparcelableModel=true'. Enable gzip request encoding using '-DuseGzipFeature=true'.");
supportedLibraries.put(RETROFIT_1, "HTTP client: OkHttp 2.7.5. JSON processing: Gson 2.3.1 (Retrofit 1.9.0). IMPORTANT NOTE: retrofit1.x is no longer actively maintained so please upgrade to 'retrofit2' instead.");
diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/Swift3Codegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/Swift3Codegen.java
index 7c45302d43a..6a2ccf176a1 100644
--- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/Swift3Codegen.java
+++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/Swift3Codegen.java
@@ -278,6 +278,11 @@ public String getSwaggerType(Property p) {
return toModelName(type);
}
+ @Override
+ public boolean isDataTypeFile(String dataType) {
+ return dataType != null && dataType.equals("URL");
+ }
+
@Override
public boolean isDataTypeBinary(final String dataType) {
return dataType != null && dataType.equals("Data");
@@ -516,6 +521,15 @@ public String toEnumVarName(String name, String datatype) {
return "empty";
}
+ Pattern startWithNumberPattern = Pattern.compile("^\\d+");
+ Matcher startWithNumberMatcher = startWithNumberPattern.matcher(name);
+ if (startWithNumberMatcher.find()) {
+ String startingNumbers = startWithNumberMatcher.group(0);
+ String nameWithoutStartingNumbers = name.substring(startingNumbers.length());
+
+ return "_" + startingNumbers + camelize(nameWithoutStartingNumbers, true);
+ }
+
// for symbol, e.g. $, #
if (getSymbolName(name) != null) {
return camelize(WordUtils.capitalizeFully(getSymbolName(name).toUpperCase()), true);
diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SwiftCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SwiftCodegen.java
index 1a12f287471..cdfcc58a109 100644
--- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SwiftCodegen.java
+++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SwiftCodegen.java
@@ -276,9 +276,14 @@ public String getSwaggerType(Property p) {
return toModelName(type);
}
+ @Override
+ public boolean isDataTypeFile(String dataType) {
+ return dataType != null && dataType.equals("NSURL");
+ }
+
@Override
public boolean isDataTypeBinary(final String dataType) {
- return dataType != null && dataType.equals("NSData");
+ return dataType != null && dataType.equals("NSData");
}
/**
diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/feign/build.gradle.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/feign/build.gradle.mustache
index 0ea9d62f542..c969ed307a9 100644
--- a/modules/swagger-codegen/src/main/resources/Java/libraries/feign/build.gradle.mustache
+++ b/modules/swagger-codegen/src/main/resources/Java/libraries/feign/build.gradle.mustache
@@ -95,9 +95,9 @@ if(hasProperty('target') && target == 'android') {
ext {
swagger_annotations_version = "1.5.9"
- jackson_version = "2.7.5"
- feign_version = "8.17.0"
- feign_form_version = "2.0.2"
+ jackson_version = "2.8.7"
+ feign_version = "9.4.0"
+ feign_form_version = "2.1.0"
junit_version = "4.12"
oltu_version = "1.0.1"
}
diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/feign/build.sbt.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/feign/build.sbt.mustache
index d0270a99b59..c2d771961a0 100644
--- a/modules/swagger-codegen/src/main/resources/Java/libraries/feign/build.sbt.mustache
+++ b/modules/swagger-codegen/src/main/resources/Java/libraries/feign/build.sbt.mustache
@@ -10,14 +10,14 @@ lazy val root = (project in file(".")).
resolvers += Resolver.mavenLocal,
libraryDependencies ++= Seq(
"io.swagger" % "swagger-annotations" % "1.5.9" % "compile",
- "com.netflix.feign" % "feign-core" % "8.16.0" % "compile",
- "com.netflix.feign" % "feign-jackson" % "8.17.0" % "compile",
- "com.netflix.feign" % "feign-slf4j" % "8.16.0" % "compile",
- "io.github.openfeign.form" % "feign-form" % "2.0.2" % "compile",
- "com.fasterxml.jackson.core" % "jackson-core" % "2.7.5" % "compile",
- "com.fasterxml.jackson.core" % "jackson-annotations" % "2.7.5" % "compile",
- "com.fasterxml.jackson.core" % "jackson-databind" % "2.7.5" % "compile",
- "com.fasterxml.jackson.datatype" % "jackson-datatype-{{^java8}}joda{{/java8}}{{#java8}}jsr310{{/java8}}" % "2.7.5" % "compile",
+ "com.netflix.feign" % "feign-core" % "9.4.0" % "compile",
+ "com.netflix.feign" % "feign-jackson" % "9.4.0" % "compile",
+ "com.netflix.feign" % "feign-slf4j" % "9.4.0" % "compile",
+ "io.github.openfeign.form" % "feign-form" % "2.1.0" % "compile",
+ "com.fasterxml.jackson.core" % "jackson-core" % "2.8.7" % "compile",
+ "com.fasterxml.jackson.core" % "jackson-annotations" % "2.8.7" % "compile",
+ "com.fasterxml.jackson.core" % "jackson-databind" % "2.8.7" % "compile",
+ "com.fasterxml.jackson.datatype" % "jackson-datatype-{{^java8}}joda{{/java8}}{{#java8}}jsr310{{/java8}}" % "2.8.7" % "compile",
"org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1" % "compile",
"com.brsanthu" % "migbase64" % "2.2" % "compile",
"junit" % "junit" % "4.12" % "test",
diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/feign/pom.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/feign/pom.mustache
index 584466ed695..da5eb7f93ab 100644
--- a/modules/swagger-codegen/src/main/resources/Java/libraries/feign/pom.mustache
+++ b/modules/swagger-codegen/src/main/resources/Java/libraries/feign/pom.mustache
@@ -176,17 +176,17 @@
- com.netflix.feign
+ io.github.openfeign
feign-core
${feign-version}
- com.netflix.feign
+ io.github.openfeign
feign-jackson
${feign-version}
- com.netflix.feign
+ io.github.openfeign
feign-slf4j
${feign-version}
@@ -236,9 +236,9 @@
${java.version}
${java.version}
1.5.12
- 8.17.0
- 2.0.2
- 2.7.5
+ 9.4.0
+ 2.1.0
+ 2.8.7
4.12
1.0.0
1.0.1
diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/pom.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/pom.mustache
index 4ddb4c6e331..cea4bea9134 100644
--- a/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/pom.mustache
+++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/pom.mustache
@@ -145,6 +145,18 @@
${cxf-version}
compile
+
+ com.fasterxml.jackson.jaxrs
+ jackson-jaxrs-json-provider
+ ${jackson-jaxrs-version}
+ compile
+
+
+ com.fasterxml.jackson.datatype
+ jackson-datatype-joda
+ ${jackson-jaxrs-version}
+ compile
+
{{#useBeanValidationFeature}}
org.hibernate
@@ -176,6 +188,7 @@
1.1.0.Final
{{/useBeanValidation}}
3.1.6
+ 2.8.4
UTF-8
diff --git a/modules/swagger-codegen/src/main/resources/csharp/api.mustache b/modules/swagger-codegen/src/main/resources/csharp/api.mustache
index b7e1afc4b5b..86e629bd257 100644
--- a/modules/swagger-codegen/src/main/resources/csharp/api.mustache
+++ b/modules/swagger-codegen/src/main/resources/csharp/api.mustache
@@ -208,7 +208,7 @@ namespace {{packageName}}.{{apiPackage}}
{{/required}}
{{/allParams}}
- var localVarPath = "{{path}}";
+ var localVarPath = "{{{path}}}";
var localVarPathParams = new Dictionary();
var localVarQueryParams = new Dictionary();
var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader);
@@ -339,7 +339,7 @@ namespace {{packageName}}.{{apiPackage}}
{{/required}}
{{/allParams}}
- var localVarPath = "{{path}}";
+ var localVarPath = "{{{path}}}";
var localVarPathParams = new Dictionary();
var localVarQueryParams = new Dictionary();
var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader);
diff --git a/modules/swagger-codegen/src/main/resources/haskell-servant/API.mustache b/modules/swagger-codegen/src/main/resources/haskell-servant/API.mustache
index 82cc63c8055..14b037cd375 100644
--- a/modules/swagger-codegen/src/main/resources/haskell-servant/API.mustache
+++ b/modules/swagger-codegen/src/main/resources/haskell-servant/API.mustache
@@ -1,65 +1,79 @@
-{-# LANGUAGE DataKinds, TypeFamilies, TypeOperators, FlexibleInstances, OverloadedStrings, ViewPatterns #-}
-{-# LANGUAGE RecordWildCards, GeneralizedNewtypeDeriving, DeriveTraversable, FlexibleContexts, DeriveGeneric #-}
-{-# OPTIONS_GHC -fno-warn-unused-binds -fno-warn-unused-imports -fcontext-stack={{contextStackLimit}} #-}
-module {{title}}.API (
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DeriveTraversable #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE RecordWildCards #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE ViewPatterns #-}
+{-# OPTIONS_GHC
+-fno-warn-unused-binds -fno-warn-unused-imports -fcontext-stack=328 #-}
+
+module {{title}}.API
-- * Client and Server
- ServerConfig(..),
- {{title}}Backend,
- create{{title}}Client,
- run{{title}}Server,
- run{{title}}Client,
- run{{title}}ClientWithManager,
- {{title}}Client,
+ ( ServerConfig(..)
+ , {{title}}Backend
+ , create{{title}}Client
+ , run{{title}}Server
+ , run{{title}}Client
+ , run{{title}}ClientWithManager
+ , {{title}}Client
-- ** Servant
- {{title}}API,
+ , {{title}}API
) where
import {{title}}.Types
+import Control.Monad.Except (ExceptT)
+import Control.Monad.IO.Class
import Data.Aeson (Value)
import Data.Coerce (coerce)
-import Servant.API
-import Servant (serve, ServantErr)
-import Web.HttpApiData
-import qualified Network.Wai.Handler.Warp as Warp
-import qualified Data.Text as T
-import Data.Text (Text)
-import Servant.Common.BaseUrl(BaseUrl(..))
-import Servant.Client (ServantError, client, Scheme(Http))
-import Data.Proxy (Proxy(..))
-import Control.Monad.IO.Class
import Data.Function ((&))
-import GHC.Exts (IsString(..))
import qualified Data.Map as Map
-import GHC.Generics (Generic)
import Data.Monoid ((<>))
-import Servant.API.Verbs (Verb, StdMethod(..))
-import Control.Monad.Except (ExceptT)
-import Network.HTTP.Client (Manager, newManager, defaultManagerSettings)
+import Data.Proxy (Proxy(..))
+import Data.Text (Text)
+import qualified Data.Text as T
+import GHC.Exts (IsString(..))
+import GHC.Generics (Generic)
+import Network.HTTP.Client (Manager, defaultManagerSettings, newManager)
import Network.HTTP.Types.Method (methodOptions)
-
-instance ReflectMethod 'OPTIONS where
- reflectMethod _ = methodOptions
+import qualified Network.Wai.Handler.Warp as Warp
+import Servant (ServantErr, serve)
+import Servant.API
+import Servant.API.Verbs (StdMethod(..), Verb)
+import Servant.Client (Scheme(Http), ServantError, client)
+import Servant.Common.BaseUrl (BaseUrl(..))
+import Web.HttpApiData
{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}{{#hasFormParams}}
data {{vendorExtensions.x-formName}} = {{vendorExtensions.x-formName}}
- { {{#formParams}}{{vendorExtensions.x-formPrefix}}{{vendorExtensions.x-formParamName}} :: {{dataType}}{{#hasMore}}
- , {{/hasMore}}{{/formParams}}
- } deriving (Show, Eq, Generic)
+ { {{#formParams}}{{vendorExtensions.x-formPrefix}}{{vendorExtensions.x-formParamName}} :: {{dataType}}{{#hasMore}}
+ , {{/hasMore}}{{/formParams}}
+ } deriving (Show, Eq, Generic)
instance FromFormUrlEncoded {{vendorExtensions.x-formName}} where
- fromFormUrlEncoded inputs = {{vendorExtensions.x-formName}} <$> {{#formParams}} lookupEither "{{baseName}}" inputs{{#hasMore}} <*> {{/hasMore}}{{/formParams}}
+ fromFormUrlEncoded inputs = {{vendorExtensions.x-formName}} <$> {{#formParams}}lookupEither "{{baseName}}" inputs{{#hasMore}} <*> {{/hasMore}}{{/formParams}}
+
instance ToFormUrlEncoded {{vendorExtensions.x-formName}} where
- toFormUrlEncoded value = [{{#formParams}}("{{baseName}}", toQueryParam $ {{vendorExtensions.x-formPrefix}}{{vendorExtensions.x-formParamName}} value){{#hasMore}}, {{/hasMore}}{{/formParams}}]
-{{/hasFormParams}}{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}
+ toFormUrlEncoded value =
+ [ {{#formParams}}("{{baseName}}", toQueryParam $ {{vendorExtensions.x-formPrefix}}{{vendorExtensions.x-formParamName}} value){{#hasMore}}
+ , {{/hasMore}}{{/formParams}}
+ ]{{/hasFormParams}}{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}
-- For the form data code generation.
-lookupEither :: FromHttpApiData b => Text -> [(Text, Text)] -> Either Text b
+lookupEither :: FromHttpApiData b => Text -> [(Text, Text)] -> Either String b
lookupEither key assocs =
case lookup key assocs of
- Nothing -> Left $ "Could not find parameter " <> key <> " in form data"
- Just value -> parseQueryParam value
+ Nothing -> Left $ "Could not find parameter " <> (T.unpack key) <> " in form data"
+ Just value ->
+ case parseQueryParam value of
+ Left result -> Left $ T.unpack result
+ Right result -> Right $ result
{{#apiInfo}}
-- | Servant type-level API, generated from the Swagger spec for {{title}}.
@@ -70,54 +84,56 @@ type {{title}}API
{{/apiInfo}}
-- | Server or client configuration, specifying the host and port to query or serve on.
-data ServerConfig = ServerConfig {
- configHost :: String, -- ^ Hostname to serve on, e.g. "127.0.0.1"
- configPort :: Int -- ^ Port to serve on, e.g. 8080
+data ServerConfig = ServerConfig
+ { configHost :: String -- ^ Hostname to serve on, e.g. "127.0.0.1"
+ , configPort :: Int -- ^ Port to serve on, e.g. 8080
} deriving (Eq, Ord, Show, Read)
-- | List of elements parsed from a query.
-newtype QueryList (p :: CollectionFormat) a = QueryList { fromQueryList :: [a] }
- deriving (Functor, Applicative, Monad, Foldable, Traversable)
+newtype QueryList (p :: CollectionFormat) a = QueryList
+ { fromQueryList :: [a]
+ } deriving (Functor, Applicative, Monad, Foldable, Traversable)
-- | Formats in which a list can be encoded into a HTTP path.
-data CollectionFormat = CommaSeparated -- ^ CSV format for multiple parameters.
- | SpaceSeparated -- ^ Also called "SSV"
- | TabSeparated -- ^ Also called "TSV"
- | PipeSeparated -- ^ `value1|value2|value2`
- | MultiParamArray -- ^ Using multiple GET parameters, e.g. `foo=bar&foo=baz`. Only for GET params.
+data CollectionFormat
+ = CommaSeparated -- ^ CSV format for multiple parameters.
+ | SpaceSeparated -- ^ Also called "SSV"
+ | TabSeparated -- ^ Also called "TSV"
+ | PipeSeparated -- ^ `value1|value2|value2`
+ | MultiParamArray -- ^ Using multiple GET parameters, e.g. `foo=bar&foo=baz`. Only for GET params.
instance FromHttpApiData a => FromHttpApiData (QueryList 'CommaSeparated a) where
- parseQueryParam = parseSeparatedQueryList ','
+ parseQueryParam = parseSeparatedQueryList ','
instance FromHttpApiData a => FromHttpApiData (QueryList 'TabSeparated a) where
- parseQueryParam = parseSeparatedQueryList '\t'
+ parseQueryParam = parseSeparatedQueryList '\t'
instance FromHttpApiData a => FromHttpApiData (QueryList 'SpaceSeparated a) where
- parseQueryParam = parseSeparatedQueryList ' '
+ parseQueryParam = parseSeparatedQueryList ' '
instance FromHttpApiData a => FromHttpApiData (QueryList 'PipeSeparated a) where
- parseQueryParam = parseSeparatedQueryList '|'
+ parseQueryParam = parseSeparatedQueryList '|'
instance FromHttpApiData a => FromHttpApiData (QueryList 'MultiParamArray a) where
- parseQueryParam = error "unimplemented FromHttpApiData for MultiParamArray collection format"
+ parseQueryParam = error "unimplemented FromHttpApiData for MultiParamArray collection format"
parseSeparatedQueryList :: FromHttpApiData a => Char -> Text -> Either Text (QueryList p a)
parseSeparatedQueryList char = fmap QueryList . mapM parseQueryParam . T.split (== char)
instance ToHttpApiData a => ToHttpApiData (QueryList 'CommaSeparated a) where
- toQueryParam = formatSeparatedQueryList ','
+ toQueryParam = formatSeparatedQueryList ','
instance ToHttpApiData a => ToHttpApiData (QueryList 'TabSeparated a) where
- toQueryParam = formatSeparatedQueryList '\t'
+ toQueryParam = formatSeparatedQueryList '\t'
instance ToHttpApiData a => ToHttpApiData (QueryList 'SpaceSeparated a) where
- toQueryParam = formatSeparatedQueryList ' '
+ toQueryParam = formatSeparatedQueryList ' '
instance ToHttpApiData a => ToHttpApiData (QueryList 'PipeSeparated a) where
- toQueryParam = formatSeparatedQueryList '|'
+ toQueryParam = formatSeparatedQueryList '|'
instance ToHttpApiData a => ToHttpApiData (QueryList 'MultiParamArray a) where
- toQueryParam = error "unimplemented ToHttpApiData for MultiParamArray collection format"
+ toQueryParam = error "unimplemented ToHttpApiData for MultiParamArray collection format"
formatSeparatedQueryList :: ToHttpApiData a => Char -> QueryList p a -> Text
formatSeparatedQueryList char = T.intercalate (T.singleton char) . map toQueryParam . fromQueryList
@@ -128,26 +144,29 @@ formatSeparatedQueryList char = T.intercalate (T.singleton char) . map toQueryPa
-- The backend can be used both for the client and the server. The client generated from the {{title}} Swagger spec
-- is a backend that executes actions by sending HTTP requests (see @create{{title}}Client@). Alternatively, provided
-- a backend, the API can be served using @run{{title}}Server@.
-data {{title}}Backend m = {{title}}Backend {
- {{#apis}}{{#operations}}{{#operation}}{{operationId}} :: {{& vendorExtensions.x-clientType}}{- ^ {{& notes}} -}{{#hasMore}},
- {{/hasMore}}{{/operation}}{{/operations}}{{#hasMore}},
- {{/hasMore}}{{/apis}}
+data {{title}}Backend m = {{title}}Backend
+ { {{#apis}}{{#operations}}{{#operation}}{{operationId}} :: {{& vendorExtensions.x-clientType}}{- ^ {{& notes}} -}{{#hasMore}}
+ , {{/hasMore}}{{/operation}}{{/operations}}{{#hasMore}}
+ , {{/hasMore}}{{/apis}}
}
-newtype {{title}}Client a = {{title}}Client { runClient :: Manager -> BaseUrl -> ExceptT ServantError IO a }
- deriving Functor
+newtype {{title}}Client a = {{title}}Client
+ { runClient :: Manager -> BaseUrl -> ExceptT ServantError IO a
+ } deriving Functor
instance Applicative {{title}}Client where
- pure x = {{title}}Client (\_ _ -> pure x)
- ({{title}}Client f) <*> ({{title}}Client x) = {{title}}Client (\manager url -> f manager url <*> x manager url)
+ pure x = {{title}}Client (\_ _ -> pure x)
+ ({{title}}Client f) <*> ({{title}}Client x) =
+ {{title}}Client (\manager url -> f manager url <*> x manager url)
instance Monad {{title}}Client where
- ({{title}}Client a) >>= f = {{title}}Client (\manager url -> do
- value <- a manager url
- runClient (f value) manager url)
+ ({{title}}Client a) >>= f =
+ {{title}}Client (\manager url -> do
+ value <- a manager url
+ runClient (f value) manager url)
instance MonadIO {{title}}Client where
- liftIO io = {{title}}Client (\_ _ -> liftIO io)
+ liftIO io = {{title}}Client (\_ _ -> liftIO io)
{{/apiInfo}}
{{#apiInfo}}
@@ -175,7 +194,6 @@ run{{title}}ClientWithManager manager clientConfig cl =
run{{title}}Server :: MonadIO m => ServerConfig -> {{title}}Backend (ExceptT ServantErr IO) -> m ()
run{{title}}Server ServerConfig{..} backend =
liftIO $ Warp.runSettings warpSettings $ serve (Proxy :: Proxy {{title}}API) (serverFromBackend backend)
-
where
warpSettings = Warp.defaultSettings & Warp.setPort configPort & Warp.setHost (fromString configHost)
serverFromBackend {{title}}Backend{..} =
diff --git a/modules/swagger-codegen/src/main/resources/haskell-servant/Types.mustache b/modules/swagger-codegen/src/main/resources/haskell-servant/Types.mustache
index 1ee62c02e1c..d5115471761 100644
--- a/modules/swagger-codegen/src/main/resources/haskell-servant/Types.mustache
+++ b/modules/swagger-codegen/src/main/resources/haskell-servant/Types.mustache
@@ -5,10 +5,10 @@
module {{title}}.Types (
{{#models}}
{{#model}}
- {{classname}} (..),
+ {{classname}} (..),
{{/model}}
{{/models}}
- ) where
+ ) where
import Data.List (stripPrefix)
import Data.Maybe (fromMaybe)
@@ -29,14 +29,14 @@ import Data.Function ((&))
{{^vendorExtensions.x-customNewtype}}
{{^parent}}
{{vendorExtensions.x-data}} {{classname}} = {{classname}}
- { {{#vars}}{{& name}} :: {{datatype}} -- ^ {{& description}}{{#hasMore}}
- , {{/hasMore}}{{/vars}}
- } deriving (Show, Eq, Generic)
+ { {{#vars}}{{& name}} :: {{datatype}} -- ^ {{& description}}{{#hasMore}}
+ , {{/hasMore}}{{/vars}}
+ } deriving (Show, Eq, Generic)
instance FromJSON {{classname}} where
- parseJSON = genericParseJSON (removeFieldLabelPrefix True "{{vendorExtensions.x-prefix}}")
+ parseJSON = genericParseJSON (removeFieldLabelPrefix True "{{vendorExtensions.x-prefix}}")
instance ToJSON {{classname}} where
- toJSON = genericToJSON (removeFieldLabelPrefix False "{{vendorExtensions.x-prefix}}")
+ toJSON = genericToJSON (removeFieldLabelPrefix False "{{vendorExtensions.x-prefix}}")
{{/parent}}
{{#parent}}
newtype {{classname}} = {{classname}} { un{{classname}} :: {{parent}} }
@@ -54,12 +54,15 @@ newtype {{classname}} = {{classname}} {{vendorExtensions.x-customNewtype}} deriv
removeFieldLabelPrefix :: Bool -> String -> Options
removeFieldLabelPrefix forParsing prefix =
defaultOptions
- { fieldLabelModifier = fromMaybe (error ("did not find prefix " ++ prefix)) . stripPrefix prefix . replaceSpecialChars
- }
+ {fieldLabelModifier = fromMaybe (error ("did not find prefix " ++ prefix)) . stripPrefix prefix . replaceSpecialChars}
where
replaceSpecialChars field = foldl (&) field (map mkCharReplacement specialChars)
- specialChars = [{{#specialCharReplacements}}("{{&char}}", "{{&replacement}}"){{#hasMore}}, {{/hasMore}}{{/specialCharReplacements}}]
+ specialChars =
+ [ {{#specialCharReplacements}}("{{&char}}", "{{&replacement}}"){{#hasMore}}
+ , {{/hasMore}}{{/specialCharReplacements}}
+ ]
mkCharReplacement (replaceStr, searchStr) = T.unpack . replacer (T.pack searchStr) (T.pack replaceStr) . T.pack
- replacer = if forParsing then flip T.replace else T.replace
-
-
+ replacer =
+ if forParsing
+ then flip T.replace
+ else T.replace
diff --git a/modules/swagger-codegen/src/main/resources/haskell-servant/stack.mustache b/modules/swagger-codegen/src/main/resources/haskell-servant/stack.mustache
index bed581391ca..36060148910 100644
--- a/modules/swagger-codegen/src/main/resources/haskell-servant/stack.mustache
+++ b/modules/swagger-codegen/src/main/resources/haskell-servant/stack.mustache
@@ -1,8 +1,8 @@
resolver: lts-5.11
extra-deps:
-- servant-0.6
-- servant-client-0.6
-- servant-server-0.6
-- http-api-data-0.2.2
+- servant-0.8.1
+- servant-client-0.8.1
+- servant-server-0.8.1
+- http-api-data-0.2.4
packages:
- '.'
diff --git a/modules/swagger-codegen/src/main/resources/scala/pom.mustache b/modules/swagger-codegen/src/main/resources/scala/pom.mustache
index 742693511d1..f0292f5789d 100644
--- a/modules/swagger-codegen/src/main/resources/scala/pom.mustache
+++ b/modules/swagger-codegen/src/main/resources/scala/pom.mustache
@@ -156,6 +156,11 @@
jackson-module-scala_2.10
${jackson-version}
+
+ com.fasterxml.jackson.datatype
+ jackson-datatype-joda
+ ${jackson-version}
+
com.sun.jersey
jersey-client
diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/swift3/Swift3CodegenTest.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/swift3/Swift3CodegenTest.java
index 6fd6afa66f2..09c86e28bbd 100644
--- a/modules/swagger-codegen/src/test/java/io/swagger/codegen/swift3/Swift3CodegenTest.java
+++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/swift3/Swift3CodegenTest.java
@@ -63,6 +63,13 @@ public void testLowercaseWithUnderscore() throws Exception {
Assert.assertEquals(swiftCodegen.toEnumVarName("entry_name", null), "entryName");
}
+ @Test
+ public void testStartingWithNumber() throws Exception {
+ Assert.assertEquals(swiftCodegen.toEnumVarName("123EntryName", null), "_123entryName");
+ Assert.assertEquals(swiftCodegen.toEnumVarName("123Entry_name", null), "_123entryName");
+ Assert.assertEquals(swiftCodegen.toEnumVarName("123EntryName123", null), "_123entryName123");
+ }
+
@Test(description = "returns NSData when response format is binary")
public void binaryDataTest() {
final Swagger model = new SwaggerParser().read("src/test/resources/2_0/binaryDataTest.json");
diff --git a/modules/swagger-codegen/src/test/resources/2_0/wordnik.yaml b/modules/swagger-codegen/src/test/resources/2_0/wordnik.yaml
index 5d46e5a8b7e..ce95ec32539 100644
--- a/modules/swagger-codegen/src/test/resources/2_0/wordnik.yaml
+++ b/modules/swagger-codegen/src/test/resources/2_0/wordnik.yaml
@@ -412,8 +412,6 @@ paths:
$ref: '#/definitions/ExampleSearchResults'
'400':
description: Invalid word supplied.
- '400':
- description: Invalid word supplied.
'/account.json/authenticate/{username}':
get:
tags:
@@ -741,7 +739,6 @@ paths:
type: array
items:
$ref: '#/definitions/WordListWord'
- $ref: '#/definitions/WordListWord'
'400':
description: Invalid ID supplied
'403':
@@ -1640,4 +1637,4 @@ definitions:
format: double
mi:
type: number
- format: double
\ No newline at end of file
+ format: double
diff --git a/pom.xml b/pom.xml
index cab4d23e0d9..3336e13c596 100644
--- a/pom.xml
+++ b/pom.xml
@@ -755,8 +755,6 @@
-
samples/client/petstore/akka-scala
samples/client/petstore/ruby
@@ -771,6 +769,7 @@
samples/client/petstore/java/retrofit
samples/client/petstore/java/retrofit2
samples/client/petstore/java/retrofit2rx
+ samples/client/petstore/jaxrs-cxf-client
samples/client/petstore/javascript
samples/client/petstore/python
samples/client/petstore/scala
diff --git a/samples/client/petstore/akka-scala/src/main/resources/reference.conf b/samples/client/petstore/akka-scala/src/main/resources/reference.conf
index f993f765edd..eefb864852e 100644
--- a/samples/client/petstore/akka-scala/src/main/resources/reference.conf
+++ b/samples/client/petstore/akka-scala/src/main/resources/reference.conf
@@ -12,7 +12,7 @@ io.swagger.client {
connection-timeout: 5000ms
default-headers {
- "userAgent": "swagger-client_1.0.0"
+ "userAgent": "scala-akka-petstore-client_1.0.0"
}
// let you define custom http status code, as in :
diff --git a/samples/client/petstore/csharp/SwaggerClient/IO.Swagger.sln b/samples/client/petstore/csharp/SwaggerClient/IO.Swagger.sln
index e5ef60c1912..16534879474 100644
--- a/samples/client/petstore/csharp/SwaggerClient/IO.Swagger.sln
+++ b/samples/client/petstore/csharp/SwaggerClient/IO.Swagger.sln
@@ -2,7 +2,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
VisualStudioVersion = 12.0.0.0
MinimumVisualStudioVersion = 10.0.0.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.csproj", "{D445A874-7512-4B21-AC14-0CC1180C9B9A}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.csproj", "{8FBEE4BD-85D4-4A5A-B723-C98D2EDB387A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger.Test", "src\IO.Swagger.Test\IO.Swagger.Test.csproj", "{19F1DEBC-DE5E-4517-8062-F000CD499087}"
EndProject
@@ -12,10 +12,10 @@ Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
-{D445A874-7512-4B21-AC14-0CC1180C9B9A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-{D445A874-7512-4B21-AC14-0CC1180C9B9A}.Debug|Any CPU.Build.0 = Debug|Any CPU
-{D445A874-7512-4B21-AC14-0CC1180C9B9A}.Release|Any CPU.ActiveCfg = Release|Any CPU
-{D445A874-7512-4B21-AC14-0CC1180C9B9A}.Release|Any CPU.Build.0 = Release|Any CPU
+{8FBEE4BD-85D4-4A5A-B723-C98D2EDB387A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+{8FBEE4BD-85D4-4A5A-B723-C98D2EDB387A}.Debug|Any CPU.Build.0 = Debug|Any CPU
+{8FBEE4BD-85D4-4A5A-B723-C98D2EDB387A}.Release|Any CPU.ActiveCfg = Release|Any CPU
+{8FBEE4BD-85D4-4A5A-B723-C98D2EDB387A}.Release|Any CPU.Build.0 = Release|Any CPU
{19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.Build.0 = Debug|Any CPU
{19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.ActiveCfg = Release|Any CPU
diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/IO.Swagger.csproj b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/IO.Swagger.csproj
index 5d56776fecb..49ce6ccefa8 100644
--- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/IO.Swagger.csproj
+++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/IO.Swagger.csproj
@@ -11,7 +11,7 @@ Contact: apiteam@swagger.io
Debug
AnyCPU
- {D445A874-7512-4B21-AC14-0CC1180C9B9A}
+ {8FBEE4BD-85D4-4A5A-B723-C98D2EDB387A}
Library
Properties
IO.Swagger
diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/IO.Swagger.sln b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/IO.Swagger.sln
index 6faeeb36d23..83e7a624ab5 100644
--- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/IO.Swagger.sln
+++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/IO.Swagger.sln
@@ -2,7 +2,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
VisualStudioVersion = 12.0.0.0
MinimumVisualStudioVersion = 10.0.0.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.csproj", "{DA3C5AEB-7E43-42AF-838D-141FF1DDB66B}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.csproj", "{415C09BC-2D6E-4641-960C-8E382CECF46C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger.Test", "src\IO.Swagger.Test\IO.Swagger.Test.csproj", "{19F1DEBC-DE5E-4517-8062-F000CD499087}"
EndProject
@@ -12,10 +12,10 @@ Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
-{DA3C5AEB-7E43-42AF-838D-141FF1DDB66B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-{DA3C5AEB-7E43-42AF-838D-141FF1DDB66B}.Debug|Any CPU.Build.0 = Debug|Any CPU
-{DA3C5AEB-7E43-42AF-838D-141FF1DDB66B}.Release|Any CPU.ActiveCfg = Release|Any CPU
-{DA3C5AEB-7E43-42AF-838D-141FF1DDB66B}.Release|Any CPU.Build.0 = Release|Any CPU
+{415C09BC-2D6E-4641-960C-8E382CECF46C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+{415C09BC-2D6E-4641-960C-8E382CECF46C}.Debug|Any CPU.Build.0 = Debug|Any CPU
+{415C09BC-2D6E-4641-960C-8E382CECF46C}.Release|Any CPU.ActiveCfg = Release|Any CPU
+{415C09BC-2D6E-4641-960C-8E382CECF46C}.Release|Any CPU.Build.0 = Release|Any CPU
{19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.Build.0 = Debug|Any CPU
{19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.ActiveCfg = Release|Any CPU
diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/docs/Capitalization.md b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/docs/Capitalization.md
new file mode 100644
index 00000000000..87d14f03e0d
--- /dev/null
+++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/docs/Capitalization.md
@@ -0,0 +1,14 @@
+# IO.Swagger.Model.Capitalization
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**SmallCamel** | **string** | | [optional]
+**CapitalCamel** | **string** | | [optional]
+**SmallSnake** | **string** | | [optional]
+**CapitalSnake** | **string** | | [optional]
+**SCAETHFlowPoints** | **string** | | [optional]
+**ATT_NAME** | **string** | Name of the pet | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/IO.Swagger.Test.csproj b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/IO.Swagger.Test.csproj
index 0706f26970f..cfe779bda71 100644
--- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/IO.Swagger.Test.csproj
+++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/IO.Swagger.Test.csproj
@@ -74,7 +74,7 @@ Contact: apiteam@swagger.io
- {DA3C5AEB-7E43-42AF-838D-141FF1DDB66B}
+ {415C09BC-2D6E-4641-960C-8E382CECF46C}
IO.Swagger
diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/CapitalizationTests.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/CapitalizationTests.cs
new file mode 100644
index 00000000000..30ed8700f74
--- /dev/null
+++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/CapitalizationTests.cs
@@ -0,0 +1,118 @@
+/*
+ * Swagger Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * OpenAPI spec version: 1.0.0
+ * Contact: apiteam@swagger.io
+ * Generated by: https://github.com/swagger-api/swagger-codegen.git
+ */
+
+
+using NUnit.Framework;
+
+using System;
+using System.Linq;
+using System.IO;
+using System.Collections.Generic;
+using IO.Swagger.Api;
+using IO.Swagger.Model;
+using IO.Swagger.Client;
+using System.Reflection;
+
+namespace IO.Swagger.Test
+{
+ ///
+ /// Class for testing Capitalization
+ ///
+ ///
+ /// This file is automatically generated by Swagger Codegen.
+ /// Please update the test case below to test the model.
+ ///
+ [TestFixture]
+ public class CapitalizationTests
+ {
+ // TODO uncomment below to declare an instance variable for Capitalization
+ //private Capitalization instance;
+
+ ///
+ /// Setup before each test
+ ///
+ [SetUp]
+ public void Init()
+ {
+ // TODO uncomment below to create an instance of Capitalization
+ //instance = new Capitalization();
+ }
+
+ ///
+ /// Clean up after each test
+ ///
+ [TearDown]
+ public void Cleanup()
+ {
+
+ }
+
+ ///
+ /// Test an instance of Capitalization
+ ///
+ [Test]
+ public void CapitalizationInstanceTest()
+ {
+ // TODO uncomment below to test "IsInstanceOfType" Capitalization
+ //Assert.IsInstanceOfType (instance, "variable 'instance' is a Capitalization");
+ }
+
+ ///
+ /// Test the property 'SmallCamel'
+ ///
+ [Test]
+ public void SmallCamelTest()
+ {
+ // TODO unit test for the property 'SmallCamel'
+ }
+ ///
+ /// Test the property 'CapitalCamel'
+ ///
+ [Test]
+ public void CapitalCamelTest()
+ {
+ // TODO unit test for the property 'CapitalCamel'
+ }
+ ///
+ /// Test the property 'SmallSnake'
+ ///
+ [Test]
+ public void SmallSnakeTest()
+ {
+ // TODO unit test for the property 'SmallSnake'
+ }
+ ///
+ /// Test the property 'CapitalSnake'
+ ///
+ [Test]
+ public void CapitalSnakeTest()
+ {
+ // TODO unit test for the property 'CapitalSnake'
+ }
+ ///
+ /// Test the property 'SCAETHFlowPoints'
+ ///
+ [Test]
+ public void SCAETHFlowPointsTest()
+ {
+ // TODO unit test for the property 'SCAETHFlowPoints'
+ }
+ ///
+ /// Test the property 'ATT_NAME'
+ ///
+ [Test]
+ public void ATT_NAMETest()
+ {
+ // TODO unit test for the property 'ATT_NAME'
+ }
+
+ }
+
+}
diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/IO.Swagger.csproj b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/IO.Swagger.csproj
index 646b0653945..b34f4a3076f 100644
--- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/IO.Swagger.csproj
+++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/IO.Swagger.csproj
@@ -11,7 +11,7 @@ Contact: apiteam@swagger.io
Debug
AnyCPU
- {DA3C5AEB-7E43-42AF-838D-141FF1DDB66B}
+ {415C09BC-2D6E-4641-960C-8E382CECF46C}
Library
Properties
IO.Swagger
diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/IO.Swagger.nuspec b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/IO.Swagger.nuspec
new file mode 100644
index 00000000000..87ba93febfe
--- /dev/null
+++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/IO.Swagger.nuspec
@@ -0,0 +1,44 @@
+
+
+
+
+ $id$
+ Swagger Library
+
+
+ $version$
+
+
+ $author$
+
+
+ $author$
+ false
+ false
+
+
+ A library generated from a Swagger doc
+ http://swagger.io/terms/
+ http://www.apache.org/licenses/LICENSE-2.0.html
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Capitalization.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Capitalization.cs
new file mode 100644
index 00000000000..2f11e06c42f
--- /dev/null
+++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Capitalization.cs
@@ -0,0 +1,213 @@
+/*
+ * Swagger Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * OpenAPI spec version: 1.0.0
+ * Contact: apiteam@swagger.io
+ * Generated by: https://github.com/swagger-api/swagger-codegen.git
+ */
+
+using System;
+using System.Linq;
+using System.IO;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Collections;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Runtime.Serialization;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Converters;
+using PropertyChanged;
+using System.ComponentModel;
+using System.ComponentModel.DataAnnotations;
+
+namespace IO.Swagger.Model
+{
+ ///
+ /// Capitalization
+ ///
+ [DataContract]
+ [ImplementPropertyChanged]
+ public partial class Capitalization : IEquatable, IValidatableObject
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// SmallCamel.
+ /// CapitalCamel.
+ /// SmallSnake.
+ /// CapitalSnake.
+ /// SCAETHFlowPoints.
+ /// Name of the pet .
+ public Capitalization(string SmallCamel = default(string), string CapitalCamel = default(string), string SmallSnake = default(string), string CapitalSnake = default(string), string SCAETHFlowPoints = default(string), string ATT_NAME = default(string))
+ {
+ this.SmallCamel = SmallCamel;
+ this.CapitalCamel = CapitalCamel;
+ this.SmallSnake = SmallSnake;
+ this.CapitalSnake = CapitalSnake;
+ this.SCAETHFlowPoints = SCAETHFlowPoints;
+ this.ATT_NAME = ATT_NAME;
+ }
+
+ ///
+ /// Gets or Sets SmallCamel
+ ///
+ [DataMember(Name="smallCamel", EmitDefaultValue=false)]
+ public string SmallCamel { get; set; }
+ ///
+ /// Gets or Sets CapitalCamel
+ ///
+ [DataMember(Name="CapitalCamel", EmitDefaultValue=false)]
+ public string CapitalCamel { get; set; }
+ ///
+ /// Gets or Sets SmallSnake
+ ///
+ [DataMember(Name="small_Snake", EmitDefaultValue=false)]
+ public string SmallSnake { get; set; }
+ ///
+ /// Gets or Sets CapitalSnake
+ ///
+ [DataMember(Name="Capital_Snake", EmitDefaultValue=false)]
+ public string CapitalSnake { get; set; }
+ ///
+ /// Gets or Sets SCAETHFlowPoints
+ ///
+ [DataMember(Name="SCA_ETH_Flow_Points", EmitDefaultValue=false)]
+ public string SCAETHFlowPoints { get; set; }
+ ///
+ /// Name of the pet
+ ///
+ /// Name of the pet
+ [DataMember(Name="ATT_NAME", EmitDefaultValue=false)]
+ public string ATT_NAME { get; set; }
+ ///
+ /// Returns the string presentation of the object
+ ///
+ /// String presentation of the object
+ public override string ToString()
+ {
+ var sb = new StringBuilder();
+ sb.Append("class Capitalization {\n");
+ sb.Append(" SmallCamel: ").Append(SmallCamel).Append("\n");
+ sb.Append(" CapitalCamel: ").Append(CapitalCamel).Append("\n");
+ sb.Append(" SmallSnake: ").Append(SmallSnake).Append("\n");
+ sb.Append(" CapitalSnake: ").Append(CapitalSnake).Append("\n");
+ sb.Append(" SCAETHFlowPoints: ").Append(SCAETHFlowPoints).Append("\n");
+ sb.Append(" ATT_NAME: ").Append(ATT_NAME).Append("\n");
+ sb.Append("}\n");
+ return sb.ToString();
+ }
+
+ ///
+ /// Returns the JSON string presentation of the object
+ ///
+ /// JSON string presentation of the object
+ public string ToJson()
+ {
+ return JsonConvert.SerializeObject(this, Formatting.Indented);
+ }
+
+ ///
+ /// Returns true if objects are equal
+ ///
+ /// Object to be compared
+ /// Boolean
+ public override bool Equals(object obj)
+ {
+ // credit: http://stackoverflow.com/a/10454552/677735
+ return this.Equals(obj as Capitalization);
+ }
+
+ ///
+ /// Returns true if Capitalization instances are equal
+ ///
+ /// Instance of Capitalization to be compared
+ /// Boolean
+ public bool Equals(Capitalization other)
+ {
+ // credit: http://stackoverflow.com/a/10454552/677735
+ if (other == null)
+ return false;
+
+ return
+ (
+ this.SmallCamel == other.SmallCamel ||
+ this.SmallCamel != null &&
+ this.SmallCamel.Equals(other.SmallCamel)
+ ) &&
+ (
+ this.CapitalCamel == other.CapitalCamel ||
+ this.CapitalCamel != null &&
+ this.CapitalCamel.Equals(other.CapitalCamel)
+ ) &&
+ (
+ this.SmallSnake == other.SmallSnake ||
+ this.SmallSnake != null &&
+ this.SmallSnake.Equals(other.SmallSnake)
+ ) &&
+ (
+ this.CapitalSnake == other.CapitalSnake ||
+ this.CapitalSnake != null &&
+ this.CapitalSnake.Equals(other.CapitalSnake)
+ ) &&
+ (
+ this.SCAETHFlowPoints == other.SCAETHFlowPoints ||
+ this.SCAETHFlowPoints != null &&
+ this.SCAETHFlowPoints.Equals(other.SCAETHFlowPoints)
+ ) &&
+ (
+ this.ATT_NAME == other.ATT_NAME ||
+ this.ATT_NAME != null &&
+ this.ATT_NAME.Equals(other.ATT_NAME)
+ );
+ }
+
+ ///
+ /// Gets the hash code
+ ///
+ /// Hash code
+ public override int GetHashCode()
+ {
+ // credit: http://stackoverflow.com/a/263416/677735
+ unchecked // Overflow is fine, just wrap
+ {
+ int hash = 41;
+ // Suitable nullity checks etc, of course :)
+ if (this.SmallCamel != null)
+ hash = hash * 59 + this.SmallCamel.GetHashCode();
+ if (this.CapitalCamel != null)
+ hash = hash * 59 + this.CapitalCamel.GetHashCode();
+ if (this.SmallSnake != null)
+ hash = hash * 59 + this.SmallSnake.GetHashCode();
+ if (this.CapitalSnake != null)
+ hash = hash * 59 + this.CapitalSnake.GetHashCode();
+ if (this.SCAETHFlowPoints != null)
+ hash = hash * 59 + this.SCAETHFlowPoints.GetHashCode();
+ if (this.ATT_NAME != null)
+ hash = hash * 59 + this.ATT_NAME.GetHashCode();
+ return hash;
+ }
+ }
+
+ public event PropertyChangedEventHandler PropertyChanged;
+
+ public virtual void OnPropertyChanged(string propertyName)
+ {
+ // NOTE: property changed is handled via "code weaving" using Fody.
+ // Properties with setters are modified at compile time to notify of changes.
+ var propertyChanged = PropertyChanged;
+ if (propertyChanged != null)
+ {
+ propertyChanged(this, new PropertyChangedEventArgs(propertyName));
+ }
+ }
+
+ public IEnumerable Validate(ValidationContext validationContext)
+ {
+ yield break;
+ }
+ }
+
+}
diff --git a/samples/client/petstore/java/feign/build.gradle b/samples/client/petstore/java/feign/build.gradle
index 0e13c2381b2..4372273e208 100644
--- a/samples/client/petstore/java/feign/build.gradle
+++ b/samples/client/petstore/java/feign/build.gradle
@@ -95,9 +95,9 @@ if(hasProperty('target') && target == 'android') {
ext {
swagger_annotations_version = "1.5.9"
- jackson_version = "2.7.5"
- feign_version = "8.17.0"
- feign_form_version = "2.0.2"
+ jackson_version = "2.8.7"
+ feign_version = "9.4.0"
+ feign_form_version = "2.1.0"
junit_version = "4.12"
oltu_version = "1.0.1"
}
diff --git a/samples/client/petstore/java/feign/build.sbt b/samples/client/petstore/java/feign/build.sbt
index dd67e3e7298..3037da434d8 100644
--- a/samples/client/petstore/java/feign/build.sbt
+++ b/samples/client/petstore/java/feign/build.sbt
@@ -10,14 +10,14 @@ lazy val root = (project in file(".")).
resolvers += Resolver.mavenLocal,
libraryDependencies ++= Seq(
"io.swagger" % "swagger-annotations" % "1.5.9" % "compile",
- "com.netflix.feign" % "feign-core" % "8.16.0" % "compile",
- "com.netflix.feign" % "feign-jackson" % "8.17.0" % "compile",
- "com.netflix.feign" % "feign-slf4j" % "8.16.0" % "compile",
- "io.github.openfeign.form" % "feign-form" % "2.0.2" % "compile",
- "com.fasterxml.jackson.core" % "jackson-core" % "2.7.5" % "compile",
- "com.fasterxml.jackson.core" % "jackson-annotations" % "2.7.5" % "compile",
- "com.fasterxml.jackson.core" % "jackson-databind" % "2.7.5" % "compile",
- "com.fasterxml.jackson.datatype" % "jackson-datatype-joda" % "2.7.5" % "compile",
+ "com.netflix.feign" % "feign-core" % "9.4.0" % "compile",
+ "com.netflix.feign" % "feign-jackson" % "9.4.0" % "compile",
+ "com.netflix.feign" % "feign-slf4j" % "9.4.0" % "compile",
+ "io.github.openfeign.form" % "feign-form" % "2.1.0" % "compile",
+ "com.fasterxml.jackson.core" % "jackson-core" % "2.8.7" % "compile",
+ "com.fasterxml.jackson.core" % "jackson-annotations" % "2.8.7" % "compile",
+ "com.fasterxml.jackson.core" % "jackson-databind" % "2.8.7" % "compile",
+ "com.fasterxml.jackson.datatype" % "jackson-datatype-joda" % "2.8.7" % "compile",
"org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1" % "compile",
"com.brsanthu" % "migbase64" % "2.2" % "compile",
"junit" % "junit" % "4.12" % "test",
diff --git a/samples/client/petstore/java/feign/pom.xml b/samples/client/petstore/java/feign/pom.xml
index b8b7c6d85a0..37d2b96f4fa 100644
--- a/samples/client/petstore/java/feign/pom.xml
+++ b/samples/client/petstore/java/feign/pom.xml
@@ -176,17 +176,17 @@
- com.netflix.feign
+ io.github.openfeign
feign-core
${feign-version}
- com.netflix.feign
+ io.github.openfeign
feign-jackson
${feign-version}
- com.netflix.feign
+ io.github.openfeign
feign-slf4j
${feign-version}
@@ -236,9 +236,9 @@
${java.version}
${java.version}
1.5.12
- 8.17.0
- 2.0.2
- 2.7.5
+ 9.4.0
+ 2.1.0
+ 2.8.7
4.12
1.0.0
1.0.1
diff --git a/samples/client/petstore/jaxrs-cxf-client/.swagger-codegen-ignore b/samples/client/petstore/jaxrs-cxf-client/.swagger-codegen-ignore
new file mode 100644
index 00000000000..70b88e71039
--- /dev/null
+++ b/samples/client/petstore/jaxrs-cxf-client/.swagger-codegen-ignore
@@ -0,0 +1,25 @@
+# Swagger Codegen Ignore
+# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen
+
+# Use this file to prevent files from being overwritten by the generator.
+# The patterns follow closely to .gitignore or .dockerignore.
+
+# As an example, the C# client generator defines ApiClient.cs.
+# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line:
+#ApiClient.cs
+
+# You can match any string of characters against a directory, file or extension with a single asterisk (*):
+#foo/*/qux
+# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
+
+# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
+#foo/**/qux
+# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
+
+# You can also negate patterns with an exclamation (!).
+# For example, you can ignore all files in a docs folder with the file extension .md:
+#docs/*.md
+# Then explicitly reverse the ignore rule for a single file:
+#!docs/README.md
+
+**/impl/*
\ No newline at end of file
diff --git a/samples/client/petstore/jaxrs-cxf-client/pom.xml b/samples/client/petstore/jaxrs-cxf-client/pom.xml
new file mode 100644
index 00000000000..aec8f7cf37e
--- /dev/null
+++ b/samples/client/petstore/jaxrs-cxf-client/pom.xml
@@ -0,0 +1,198 @@
+
+ 4.0.0
+ io.swagger
+ jaxrs-cxf-petstore-client
+ war
+ jaxrs-cxf-petstore-client
+ 1.0.0
+
+ src/main/java
+
+
+ maven-failsafe-plugin
+ 2.6
+
+
+
+ integration-test
+ verify
+
+
+
+
+
+
+ org.codehaus.mojo
+ build-helper-maven-plugin
+ 1.9.1
+
+
+ add-source
+ generate-sources
+
+ add-source
+
+
+
+ src/gen/java
+
+
+
+
+
+
+
+
+ maven-war-plugin
+ 2.1.1
+
+ false
+
+
+
+
+
+
+ io.swagger
+ swagger-jaxrs
+ compile
+ ${swagger-core-version}
+
+
+ ch.qos.logback
+ logback-classic
+ ${logback-version}
+ compile
+
+
+ ch.qos.logback
+ logback-core
+ ${logback-version}
+ compile
+
+
+ junit
+ junit
+ ${junit-version}
+ test
+
+
+
+ javax.validation
+ validation-api
+ ${beanvalidation-version}
+ provided
+
+
+
+ org.apache.cxf
+ cxf-rt-rs-client
+ ${cxf-version}
+ test
+
+
+
+
+ org.apache.cxf
+ cxf-rt-frontend-jaxrs
+ ${cxf-version}
+ compile
+
+
+ org.apache.cxf
+ cxf-rt-rs-service-description
+ ${cxf-version}
+ compile
+
+
+ org.apache.cxf
+ cxf-rt-rs-service-description-swagger
+ ${cxf-version}
+ compile
+
+
+ org.apache.cxf
+ cxf-rt-ws-policy
+ ${cxf-version}
+ compile
+
+
+ org.apache.cxf
+ cxf-rt-wsdl
+ ${cxf-version}
+ compile
+
+
+ com.fasterxml.jackson.jaxrs
+ jackson-jaxrs-json-provider
+ ${jackson-jaxrs-version}
+ compile
+
+
+ com.fasterxml.jackson.datatype
+ jackson-datatype-joda
+ ${jackson-jaxrs-version}
+ compile
+
+
+
+
+ sonatype-snapshots
+ https://oss.sonatype.org/content/repositories/snapshots
+
+ true
+
+
+
+
+ 1.7
+ ${java.version}
+ ${java.version}
+ 1.5.12
+ 9.2.9.v20150224
+ 2.22.2
+ 4.12
+ 1.1.7
+ 2.5
+ 1.1.0.Final
+ 3.1.8
+ 2.8.4
+ UTF-8
+
+
diff --git a/samples/client/petstore/jaxrs-cxf-client/src/gen/java/io/swagger/api/PetApi.java b/samples/client/petstore/jaxrs-cxf-client/src/gen/java/io/swagger/api/PetApi.java
new file mode 100644
index 00000000000..68701e28cc2
--- /dev/null
+++ b/samples/client/petstore/jaxrs-cxf-client/src/gen/java/io/swagger/api/PetApi.java
@@ -0,0 +1,101 @@
+package io.swagger.api;
+
+import java.io.File;
+import io.swagger.model.ModelApiResponse;
+import io.swagger.model.Pet;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.List;
+import java.util.Map;
+import javax.ws.rs.*;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.MediaType;
+import org.apache.cxf.jaxrs.ext.multipart.*;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiResponses;
+import io.swagger.annotations.ApiResponse;
+import io.swagger.jaxrs.PATCH;
+import javax.validation.constraints.*;
+
+@Path("/")
+@Api(value = "/", description = "")
+public interface PetApi {
+
+ @POST
+ @Path("/pet")
+ @Consumes({ "application/json", "application/xml" })
+ @Produces({ "application/xml", "application/json" })
+ @ApiOperation(value = "Add a new pet to the store", tags={ "pet", })
+ @ApiResponses(value = {
+ @ApiResponse(code = 405, message = "Invalid input") })
+ public void addPet(Pet body);
+
+ @DELETE
+ @Path("/pet/{petId}")
+ @Produces({ "application/xml", "application/json" })
+ @ApiOperation(value = "Deletes a pet", tags={ "pet", })
+ @ApiResponses(value = {
+ @ApiResponse(code = 400, message = "Invalid pet value") })
+ public void deletePet(@PathParam("petId") Long petId, @HeaderParam("api_key") String apiKey);
+
+ @GET
+ @Path("/pet/findByStatus")
+ @Produces({ "application/xml", "application/json" })
+ @ApiOperation(value = "Finds Pets by status", tags={ "pet", })
+ @ApiResponses(value = {
+ @ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"),
+ @ApiResponse(code = 400, message = "Invalid status value") })
+ public List findPetsByStatus(@QueryParam("status") @NotNull List status);
+
+ @GET
+ @Path("/pet/findByTags")
+ @Produces({ "application/xml", "application/json" })
+ @ApiOperation(value = "Finds Pets by tags", tags={ "pet", })
+ @ApiResponses(value = {
+ @ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"),
+ @ApiResponse(code = 400, message = "Invalid tag value") })
+ public List findPetsByTags(@QueryParam("tags") @NotNull List tags);
+
+ @GET
+ @Path("/pet/{petId}")
+ @Produces({ "application/xml", "application/json" })
+ @ApiOperation(value = "Find pet by ID", tags={ "pet", })
+ @ApiResponses(value = {
+ @ApiResponse(code = 200, message = "successful operation", response = Pet.class),
+ @ApiResponse(code = 400, message = "Invalid ID supplied"),
+ @ApiResponse(code = 404, message = "Pet not found") })
+ public Pet getPetById(@PathParam("petId") Long petId);
+
+ @PUT
+ @Path("/pet")
+ @Consumes({ "application/json", "application/xml" })
+ @Produces({ "application/xml", "application/json" })
+ @ApiOperation(value = "Update an existing pet", tags={ "pet", })
+ @ApiResponses(value = {
+ @ApiResponse(code = 400, message = "Invalid ID supplied"),
+ @ApiResponse(code = 404, message = "Pet not found"),
+ @ApiResponse(code = 405, message = "Validation exception") })
+ public void updatePet(Pet body);
+
+ @POST
+ @Path("/pet/{petId}")
+ @Consumes({ "application/x-www-form-urlencoded" })
+ @Produces({ "application/xml", "application/json" })
+ @ApiOperation(value = "Updates a pet in the store with form data", tags={ "pet", })
+ @ApiResponses(value = {
+ @ApiResponse(code = 405, message = "Invalid input") })
+ public void updatePetWithForm(@PathParam("petId") Long petId, @Multipart(value = "name", required = false) String name, @Multipart(value = "status", required = false) String status);
+
+ @POST
+ @Path("/pet/{petId}/uploadImage")
+ @Consumes({ "multipart/form-data" })
+ @Produces({ "application/json" })
+ @ApiOperation(value = "uploads an image", tags={ "pet" })
+ @ApiResponses(value = {
+ @ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) })
+ public ModelApiResponse uploadFile(@PathParam("petId") Long petId, @Multipart(value = "additionalMetadata", required = false) String additionalMetadata, @Multipart(value = "file" , required = false) Attachment fileDetail);
+}
+
diff --git a/samples/client/petstore/jaxrs-cxf-client/src/gen/java/io/swagger/api/StoreApi.java b/samples/client/petstore/jaxrs-cxf-client/src/gen/java/io/swagger/api/StoreApi.java
new file mode 100644
index 00000000000..f6f1b34c243
--- /dev/null
+++ b/samples/client/petstore/jaxrs-cxf-client/src/gen/java/io/swagger/api/StoreApi.java
@@ -0,0 +1,62 @@
+package io.swagger.api;
+
+import java.util.Map;
+import io.swagger.model.Order;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.List;
+import java.util.Map;
+import javax.ws.rs.*;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.MediaType;
+import org.apache.cxf.jaxrs.ext.multipart.*;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiResponses;
+import io.swagger.annotations.ApiResponse;
+import io.swagger.jaxrs.PATCH;
+import javax.validation.constraints.*;
+
+@Path("/")
+@Api(value = "/", description = "")
+public interface StoreApi {
+
+ @DELETE
+ @Path("/store/order/{orderId}")
+ @Produces({ "application/xml", "application/json" })
+ @ApiOperation(value = "Delete purchase order by ID", tags={ "store", })
+ @ApiResponses(value = {
+ @ApiResponse(code = 400, message = "Invalid ID supplied"),
+ @ApiResponse(code = 404, message = "Order not found") })
+ public void deleteOrder(@PathParam("orderId") String orderId);
+
+ @GET
+ @Path("/store/inventory")
+ @Produces({ "application/json" })
+ @ApiOperation(value = "Returns pet inventories by status", tags={ "store", })
+ @ApiResponses(value = {
+ @ApiResponse(code = 200, message = "successful operation", response = Map.class, responseContainer = "Map") })
+ public Map getInventory();
+
+ @GET
+ @Path("/store/order/{orderId}")
+ @Produces({ "application/xml", "application/json" })
+ @ApiOperation(value = "Find purchase order by ID", tags={ "store", })
+ @ApiResponses(value = {
+ @ApiResponse(code = 200, message = "successful operation", response = Order.class),
+ @ApiResponse(code = 400, message = "Invalid ID supplied"),
+ @ApiResponse(code = 404, message = "Order not found") })
+ public Order getOrderById(@PathParam("orderId") @Min(1) @Max(5) Long orderId);
+
+ @POST
+ @Path("/store/order")
+ @Produces({ "application/xml", "application/json" })
+ @ApiOperation(value = "Place an order for a pet", tags={ "store" })
+ @ApiResponses(value = {
+ @ApiResponse(code = 200, message = "successful operation", response = Order.class),
+ @ApiResponse(code = 400, message = "Invalid Order") })
+ public Order placeOrder(Order body);
+}
+
diff --git a/samples/client/petstore/jaxrs-cxf-client/src/gen/java/io/swagger/api/UserApi.java b/samples/client/petstore/jaxrs-cxf-client/src/gen/java/io/swagger/api/UserApi.java
new file mode 100644
index 00000000000..172b6938f1d
--- /dev/null
+++ b/samples/client/petstore/jaxrs-cxf-client/src/gen/java/io/swagger/api/UserApi.java
@@ -0,0 +1,95 @@
+package io.swagger.api;
+
+import java.util.List;
+import io.swagger.model.User;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.List;
+import java.util.Map;
+import javax.ws.rs.*;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.MediaType;
+import org.apache.cxf.jaxrs.ext.multipart.*;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiResponses;
+import io.swagger.annotations.ApiResponse;
+import io.swagger.jaxrs.PATCH;
+import javax.validation.constraints.*;
+
+@Path("/")
+@Api(value = "/", description = "")
+public interface UserApi {
+
+ @POST
+ @Path("/user")
+ @Produces({ "application/xml", "application/json" })
+ @ApiOperation(value = "Create user", tags={ "user", })
+ @ApiResponses(value = {
+ @ApiResponse(code = 200, message = "successful operation") })
+ public void createUser(User body);
+
+ @POST
+ @Path("/user/createWithArray")
+ @Produces({ "application/xml", "application/json" })
+ @ApiOperation(value = "Creates list of users with given input array", tags={ "user", })
+ @ApiResponses(value = {
+ @ApiResponse(code = 200, message = "successful operation") })
+ public void createUsersWithArrayInput(List body);
+
+ @POST
+ @Path("/user/createWithList")
+ @Produces({ "application/xml", "application/json" })
+ @ApiOperation(value = "Creates list of users with given input array", tags={ "user", })
+ @ApiResponses(value = {
+ @ApiResponse(code = 200, message = "successful operation") })
+ public void createUsersWithListInput(List body);
+
+ @DELETE
+ @Path("/user/{username}")
+ @Produces({ "application/xml", "application/json" })
+ @ApiOperation(value = "Delete user", tags={ "user", })
+ @ApiResponses(value = {
+ @ApiResponse(code = 400, message = "Invalid username supplied"),
+ @ApiResponse(code = 404, message = "User not found") })
+ public void deleteUser(@PathParam("username") String username);
+
+ @GET
+ @Path("/user/{username}")
+ @Produces({ "application/xml", "application/json" })
+ @ApiOperation(value = "Get user by user name", tags={ "user", })
+ @ApiResponses(value = {
+ @ApiResponse(code = 200, message = "successful operation", response = User.class),
+ @ApiResponse(code = 400, message = "Invalid username supplied"),
+ @ApiResponse(code = 404, message = "User not found") })
+ public User getUserByName(@PathParam("username") String username);
+
+ @GET
+ @Path("/user/login")
+ @Produces({ "application/xml", "application/json" })
+ @ApiOperation(value = "Logs user into the system", tags={ "user", })
+ @ApiResponses(value = {
+ @ApiResponse(code = 200, message = "successful operation", response = String.class),
+ @ApiResponse(code = 400, message = "Invalid username/password supplied") })
+ public String loginUser(@QueryParam("username") @NotNull String username, @QueryParam("password") @NotNull String password);
+
+ @GET
+ @Path("/user/logout")
+ @Produces({ "application/xml", "application/json" })
+ @ApiOperation(value = "Logs out current logged in user session", tags={ "user", })
+ @ApiResponses(value = {
+ @ApiResponse(code = 200, message = "successful operation") })
+ public void logoutUser();
+
+ @PUT
+ @Path("/user/{username}")
+ @Produces({ "application/xml", "application/json" })
+ @ApiOperation(value = "Updated user", tags={ "user" })
+ @ApiResponses(value = {
+ @ApiResponse(code = 400, message = "Invalid user supplied"),
+ @ApiResponse(code = 404, message = "User not found") })
+ public void updateUser(@PathParam("username") String username, User body);
+}
+
diff --git a/samples/client/petstore/jaxrs-cxf-client/src/gen/java/io/swagger/model/Category.java b/samples/client/petstore/jaxrs-cxf-client/src/gen/java/io/swagger/model/Category.java
new file mode 100644
index 00000000000..c6076fb8df8
--- /dev/null
+++ b/samples/client/petstore/jaxrs-cxf-client/src/gen/java/io/swagger/model/Category.java
@@ -0,0 +1,80 @@
+package io.swagger.model;
+
+import io.swagger.annotations.ApiModel;
+import javax.validation.constraints.*;
+
+import io.swagger.annotations.ApiModelProperty;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.XmlEnum;
+import javax.xml.bind.annotation.XmlEnumValue;
+
+@ApiModel(description="A category for a pet")
+public class Category {
+
+ @ApiModelProperty(value = "")
+ private Long id = null;
+ @ApiModelProperty(value = "")
+ private String name = null;
+
+ /**
+ * Get id
+ * @return id
+ **/
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public Category id(Long id) {
+ this.id = id;
+ return this;
+ }
+
+ /**
+ * Get name
+ * @return name
+ **/
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Category name(String name) {
+ this.name = name;
+ return this;
+ }
+
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("class Category {\n");
+
+ sb.append(" id: ").append(toIndentedString(id)).append("\n");
+ sb.append(" name: ").append(toIndentedString(name)).append("\n");
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces
+ * (except the first line).
+ */
+ private static String toIndentedString(java.lang.Object o) {
+ if (o == null) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n ");
+ }
+}
+
diff --git a/samples/client/petstore/jaxrs-cxf-client/src/gen/java/io/swagger/model/ModelApiResponse.java b/samples/client/petstore/jaxrs-cxf-client/src/gen/java/io/swagger/model/ModelApiResponse.java
new file mode 100644
index 00000000000..4877f3ace31
--- /dev/null
+++ b/samples/client/petstore/jaxrs-cxf-client/src/gen/java/io/swagger/model/ModelApiResponse.java
@@ -0,0 +1,100 @@
+package io.swagger.model;
+
+import io.swagger.annotations.ApiModel;
+import javax.validation.constraints.*;
+
+import io.swagger.annotations.ApiModelProperty;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.XmlEnum;
+import javax.xml.bind.annotation.XmlEnumValue;
+
+@ApiModel(description="Describes the result of uploading an image resource")
+public class ModelApiResponse {
+
+ @ApiModelProperty(value = "")
+ private Integer code = null;
+ @ApiModelProperty(value = "")
+ private String type = null;
+ @ApiModelProperty(value = "")
+ private String message = null;
+
+ /**
+ * Get code
+ * @return code
+ **/
+ public Integer getCode() {
+ return code;
+ }
+
+ public void setCode(Integer code) {
+ this.code = code;
+ }
+
+ public ModelApiResponse code(Integer code) {
+ this.code = code;
+ return this;
+ }
+
+ /**
+ * Get type
+ * @return type
+ **/
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public ModelApiResponse type(String type) {
+ this.type = type;
+ return this;
+ }
+
+ /**
+ * Get message
+ * @return message
+ **/
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public ModelApiResponse message(String message) {
+ this.message = message;
+ return this;
+ }
+
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("class ModelApiResponse {\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 static String toIndentedString(java.lang.Object o) {
+ if (o == null) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n ");
+ }
+}
+
diff --git a/samples/client/petstore/jaxrs-cxf-client/src/gen/java/io/swagger/model/Order.java b/samples/client/petstore/jaxrs-cxf-client/src/gen/java/io/swagger/model/Order.java
new file mode 100644
index 00000000000..a5bdf93b6f3
--- /dev/null
+++ b/samples/client/petstore/jaxrs-cxf-client/src/gen/java/io/swagger/model/Order.java
@@ -0,0 +1,194 @@
+package io.swagger.model;
+
+import io.swagger.annotations.ApiModel;
+import java.util.Date;
+import javax.validation.constraints.*;
+
+import io.swagger.annotations.ApiModelProperty;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.XmlEnum;
+import javax.xml.bind.annotation.XmlEnumValue;
+
+@ApiModel(description="An order for a pets from the pet store")
+public class Order {
+
+ @ApiModelProperty(value = "")
+ private Long id = null;
+ @ApiModelProperty(value = "")
+ private Long petId = null;
+ @ApiModelProperty(value = "")
+ private Integer quantity = null;
+ @ApiModelProperty(value = "")
+ private Date shipDate = null;
+
+@XmlType(name="StatusEnum")
+@XmlEnum(String.class)
+public enum StatusEnum {
+
+@XmlEnumValue("placed") PLACED(String.valueOf("placed")), @XmlEnumValue("approved") APPROVED(String.valueOf("approved")), @XmlEnumValue("delivered") DELIVERED(String.valueOf("delivered"));
+
+
+ private String value;
+
+ StatusEnum (String v) {
+ value = v;
+ }
+
+ public String value() {
+ return value;
+ }
+
+ @Override
+ public String toString() {
+ return String.valueOf(value);
+ }
+
+ public static StatusEnum fromValue(String v) {
+ for (StatusEnum b : StatusEnum.values()) {
+ if (String.valueOf(b.value).equals(v)) {
+ return b;
+ }
+ }
+ return null;
+ }
+}
+
+ @ApiModelProperty(value = "Order Status")
+ private StatusEnum status = null;
+ @ApiModelProperty(value = "")
+ private Boolean complete = false;
+
+ /**
+ * Get id
+ * @return id
+ **/
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public Order id(Long id) {
+ this.id = id;
+ return this;
+ }
+
+ /**
+ * Get petId
+ * @return petId
+ **/
+ public Long getPetId() {
+ return petId;
+ }
+
+ public void setPetId(Long petId) {
+ this.petId = petId;
+ }
+
+ public Order petId(Long petId) {
+ this.petId = petId;
+ return this;
+ }
+
+ /**
+ * Get quantity
+ * @return quantity
+ **/
+ public Integer getQuantity() {
+ return quantity;
+ }
+
+ public void setQuantity(Integer quantity) {
+ this.quantity = quantity;
+ }
+
+ public Order quantity(Integer quantity) {
+ this.quantity = quantity;
+ return this;
+ }
+
+ /**
+ * Get shipDate
+ * @return shipDate
+ **/
+ public Date getShipDate() {
+ return shipDate;
+ }
+
+ public void setShipDate(Date shipDate) {
+ this.shipDate = shipDate;
+ }
+
+ public Order shipDate(Date shipDate) {
+ this.shipDate = shipDate;
+ return this;
+ }
+
+ /**
+ * Order Status
+ * @return status
+ **/
+ public StatusEnum getStatus() {
+ return status;
+ }
+
+ public void setStatus(StatusEnum status) {
+ this.status = status;
+ }
+
+ public Order status(StatusEnum status) {
+ this.status = status;
+ return this;
+ }
+
+ /**
+ * Get complete
+ * @return complete
+ **/
+ public Boolean getComplete() {
+ return complete;
+ }
+
+ public void setComplete(Boolean complete) {
+ this.complete = complete;
+ }
+
+ public Order complete(Boolean complete) {
+ this.complete = complete;
+ return this;
+ }
+
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("class Order {\n");
+
+ sb.append(" id: ").append(toIndentedString(id)).append("\n");
+ sb.append(" petId: ").append(toIndentedString(petId)).append("\n");
+ sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n");
+ sb.append(" shipDate: ").append(toIndentedString(shipDate)).append("\n");
+ sb.append(" status: ").append(toIndentedString(status)).append("\n");
+ sb.append(" complete: ").append(toIndentedString(complete)).append("\n");
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces
+ * (except the first line).
+ */
+ private static String toIndentedString(java.lang.Object o) {
+ if (o == null) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n ");
+ }
+}
+
diff --git a/samples/client/petstore/jaxrs-cxf-client/src/gen/java/io/swagger/model/Pet.java b/samples/client/petstore/jaxrs-cxf-client/src/gen/java/io/swagger/model/Pet.java
new file mode 100644
index 00000000000..15f9322a95a
--- /dev/null
+++ b/samples/client/petstore/jaxrs-cxf-client/src/gen/java/io/swagger/model/Pet.java
@@ -0,0 +1,209 @@
+package io.swagger.model;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.model.Category;
+import io.swagger.model.Tag;
+import java.util.ArrayList;
+import java.util.List;
+import javax.validation.constraints.*;
+
+import io.swagger.annotations.ApiModelProperty;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.XmlEnum;
+import javax.xml.bind.annotation.XmlEnumValue;
+
+@ApiModel(description="A pet for sale in the pet store")
+public class Pet {
+
+ @ApiModelProperty(value = "")
+ private Long id = null;
+ @ApiModelProperty(value = "")
+ private Category category = null;
+ @ApiModelProperty(example = "doggie", required = true, value = "")
+ private String name = null;
+ @ApiModelProperty(required = true, value = "")
+ private List photoUrls = new ArrayList();
+ @ApiModelProperty(value = "")
+ private List tags = new ArrayList();
+
+@XmlType(name="StatusEnum")
+@XmlEnum(String.class)
+public enum StatusEnum {
+
+@XmlEnumValue("available") AVAILABLE(String.valueOf("available")), @XmlEnumValue("pending") PENDING(String.valueOf("pending")), @XmlEnumValue("sold") SOLD(String.valueOf("sold"));
+
+
+ private String value;
+
+ StatusEnum (String v) {
+ value = v;
+ }
+
+ public String value() {
+ return value;
+ }
+
+ @Override
+ public String toString() {
+ return String.valueOf(value);
+ }
+
+ public static StatusEnum fromValue(String v) {
+ for (StatusEnum b : StatusEnum.values()) {
+ if (String.valueOf(b.value).equals(v)) {
+ return b;
+ }
+ }
+ return null;
+ }
+}
+
+ @ApiModelProperty(value = "pet status in the store")
+ private StatusEnum status = null;
+
+ /**
+ * Get id
+ * @return id
+ **/
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public Pet id(Long id) {
+ this.id = id;
+ return this;
+ }
+
+ /**
+ * Get category
+ * @return category
+ **/
+ public Category getCategory() {
+ return category;
+ }
+
+ public void setCategory(Category category) {
+ this.category = category;
+ }
+
+ public Pet category(Category category) {
+ this.category = category;
+ return this;
+ }
+
+ /**
+ * Get name
+ * @return name
+ **/
+ @NotNull
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Pet name(String name) {
+ this.name = name;
+ return this;
+ }
+
+ /**
+ * Get photoUrls
+ * @return photoUrls
+ **/
+ @NotNull
+ public List getPhotoUrls() {
+ return photoUrls;
+ }
+
+ public void setPhotoUrls(List photoUrls) {
+ this.photoUrls = photoUrls;
+ }
+
+ public Pet photoUrls(List photoUrls) {
+ this.photoUrls = photoUrls;
+ return this;
+ }
+
+ public Pet addPhotoUrlsItem(String photoUrlsItem) {
+ this.photoUrls.add(photoUrlsItem);
+ return this;
+ }
+
+ /**
+ * Get tags
+ * @return tags
+ **/
+ public List getTags() {
+ return tags;
+ }
+
+ public void setTags(List tags) {
+ this.tags = tags;
+ }
+
+ public Pet tags(List tags) {
+ this.tags = tags;
+ return this;
+ }
+
+ public Pet addTagsItem(Tag tagsItem) {
+ this.tags.add(tagsItem);
+ return this;
+ }
+
+ /**
+ * pet status in the store
+ * @return status
+ **/
+ public StatusEnum getStatus() {
+ return status;
+ }
+
+ public void setStatus(StatusEnum status) {
+ this.status = status;
+ }
+
+ public Pet status(StatusEnum status) {
+ this.status = status;
+ return this;
+ }
+
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("class Pet {\n");
+
+ sb.append(" id: ").append(toIndentedString(id)).append("\n");
+ sb.append(" category: ").append(toIndentedString(category)).append("\n");
+ sb.append(" name: ").append(toIndentedString(name)).append("\n");
+ sb.append(" photoUrls: ").append(toIndentedString(photoUrls)).append("\n");
+ sb.append(" tags: ").append(toIndentedString(tags)).append("\n");
+ sb.append(" status: ").append(toIndentedString(status)).append("\n");
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces
+ * (except the first line).
+ */
+ private static String toIndentedString(java.lang.Object o) {
+ if (o == null) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n ");
+ }
+}
+
diff --git a/samples/client/petstore/jaxrs-cxf-client/src/gen/java/io/swagger/model/Tag.java b/samples/client/petstore/jaxrs-cxf-client/src/gen/java/io/swagger/model/Tag.java
new file mode 100644
index 00000000000..a0bfd24470f
--- /dev/null
+++ b/samples/client/petstore/jaxrs-cxf-client/src/gen/java/io/swagger/model/Tag.java
@@ -0,0 +1,80 @@
+package io.swagger.model;
+
+import io.swagger.annotations.ApiModel;
+import javax.validation.constraints.*;
+
+import io.swagger.annotations.ApiModelProperty;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.XmlEnum;
+import javax.xml.bind.annotation.XmlEnumValue;
+
+@ApiModel(description="A tag for a pet")
+public class Tag {
+
+ @ApiModelProperty(value = "")
+ private Long id = null;
+ @ApiModelProperty(value = "")
+ private String name = null;
+
+ /**
+ * Get id
+ * @return id
+ **/
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public Tag id(Long id) {
+ this.id = id;
+ return this;
+ }
+
+ /**
+ * Get name
+ * @return name
+ **/
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Tag name(String name) {
+ this.name = name;
+ return this;
+ }
+
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("class Tag {\n");
+
+ sb.append(" id: ").append(toIndentedString(id)).append("\n");
+ sb.append(" name: ").append(toIndentedString(name)).append("\n");
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces
+ * (except the first line).
+ */
+ private static String toIndentedString(java.lang.Object o) {
+ if (o == null) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n ");
+ }
+}
+
diff --git a/samples/client/petstore/jaxrs-cxf-client/src/gen/java/io/swagger/model/User.java b/samples/client/petstore/jaxrs-cxf-client/src/gen/java/io/swagger/model/User.java
new file mode 100644
index 00000000000..74b908a3aa3
--- /dev/null
+++ b/samples/client/petstore/jaxrs-cxf-client/src/gen/java/io/swagger/model/User.java
@@ -0,0 +1,200 @@
+package io.swagger.model;
+
+import io.swagger.annotations.ApiModel;
+import javax.validation.constraints.*;
+
+import io.swagger.annotations.ApiModelProperty;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.XmlEnum;
+import javax.xml.bind.annotation.XmlEnumValue;
+
+@ApiModel(description="A User who is purchasing from the pet store")
+public class User {
+
+ @ApiModelProperty(value = "")
+ private Long id = null;
+ @ApiModelProperty(value = "")
+ private String username = null;
+ @ApiModelProperty(value = "")
+ private String firstName = null;
+ @ApiModelProperty(value = "")
+ private String lastName = null;
+ @ApiModelProperty(value = "")
+ private String email = null;
+ @ApiModelProperty(value = "")
+ private String password = null;
+ @ApiModelProperty(value = "")
+ private String phone = null;
+ @ApiModelProperty(value = "User Status")
+ private Integer userStatus = null;
+
+ /**
+ * Get id
+ * @return id
+ **/
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public User id(Long id) {
+ this.id = id;
+ return this;
+ }
+
+ /**
+ * Get username
+ * @return username
+ **/
+ public String getUsername() {
+ return username;
+ }
+
+ public void setUsername(String username) {
+ this.username = username;
+ }
+
+ public User username(String username) {
+ this.username = username;
+ return this;
+ }
+
+ /**
+ * Get firstName
+ * @return firstName
+ **/
+ public String getFirstName() {
+ return firstName;
+ }
+
+ public void setFirstName(String firstName) {
+ this.firstName = firstName;
+ }
+
+ public User firstName(String firstName) {
+ this.firstName = firstName;
+ return this;
+ }
+
+ /**
+ * Get lastName
+ * @return lastName
+ **/
+ public String getLastName() {
+ return lastName;
+ }
+
+ public void setLastName(String lastName) {
+ this.lastName = lastName;
+ }
+
+ public User lastName(String lastName) {
+ this.lastName = lastName;
+ return this;
+ }
+
+ /**
+ * Get email
+ * @return email
+ **/
+ public String getEmail() {
+ return email;
+ }
+
+ public void setEmail(String email) {
+ this.email = email;
+ }
+
+ public User email(String email) {
+ this.email = email;
+ return this;
+ }
+
+ /**
+ * Get password
+ * @return password
+ **/
+ public String getPassword() {
+ return password;
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+ public User password(String password) {
+ this.password = password;
+ return this;
+ }
+
+ /**
+ * Get phone
+ * @return phone
+ **/
+ public String getPhone() {
+ return phone;
+ }
+
+ public void setPhone(String phone) {
+ this.phone = phone;
+ }
+
+ public User phone(String phone) {
+ this.phone = phone;
+ return this;
+ }
+
+ /**
+ * User Status
+ * @return userStatus
+ **/
+ public Integer getUserStatus() {
+ return userStatus;
+ }
+
+ public void setUserStatus(Integer userStatus) {
+ this.userStatus = userStatus;
+ }
+
+ public User userStatus(Integer userStatus) {
+ this.userStatus = userStatus;
+ return this;
+ }
+
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("class User {\n");
+
+ sb.append(" id: ").append(toIndentedString(id)).append("\n");
+ sb.append(" username: ").append(toIndentedString(username)).append("\n");
+ sb.append(" firstName: ").append(toIndentedString(firstName)).append("\n");
+ sb.append(" lastName: ").append(toIndentedString(lastName)).append("\n");
+ sb.append(" email: ").append(toIndentedString(email)).append("\n");
+ sb.append(" password: ").append(toIndentedString(password)).append("\n");
+ sb.append(" phone: ").append(toIndentedString(phone)).append("\n");
+ sb.append(" userStatus: ").append(toIndentedString(userStatus)).append("\n");
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces
+ * (except the first line).
+ */
+ private static String toIndentedString(java.lang.Object o) {
+ if (o == null) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n ");
+ }
+}
+
diff --git a/samples/client/petstore/jaxrs-cxf-client/src/main/java/io/swagger/api/impl/PetApiServiceImpl.java b/samples/client/petstore/jaxrs-cxf-client/src/main/java/io/swagger/api/impl/PetApiServiceImpl.java
new file mode 100644
index 00000000000..d9b9345d339
--- /dev/null
+++ b/samples/client/petstore/jaxrs-cxf-client/src/main/java/io/swagger/api/impl/PetApiServiceImpl.java
@@ -0,0 +1,71 @@
+package io.swagger.api.impl;
+
+import io.swagger.api.*;
+import java.io.File;
+import io.swagger.model.ModelApiResponse;
+import io.swagger.model.Pet;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.List;
+import java.util.Map;
+import javax.ws.rs.*;
+import javax.ws.rs.core.Response;
+import org.apache.cxf.jaxrs.model.wadl.Description;
+import org.apache.cxf.jaxrs.model.wadl.DocTarget;
+
+import org.apache.cxf.jaxrs.ext.multipart.*;
+
+import io.swagger.annotations.Api;
+
+public class PetApiServiceImpl implements PetApi {
+ public void addPet(Pet body) {
+ // TODO: Implement...
+
+
+ }
+
+ public void deletePet(Long petId, String apiKey) {
+ // TODO: Implement...
+
+
+ }
+
+ public List findPetsByStatus(List status) {
+ // TODO: Implement...
+
+ return null;
+ }
+
+ public List findPetsByTags(List tags) {
+ // TODO: Implement...
+
+ return null;
+ }
+
+ public Pet getPetById(Long petId) {
+ // TODO: Implement...
+
+ return null;
+ }
+
+ public void updatePet(Pet body) {
+ // TODO: Implement...
+
+
+ }
+
+ public void updatePetWithForm(Long petId, String name, String status) {
+ // TODO: Implement...
+
+
+ }
+
+ public ModelApiResponse uploadFile(Long petId, String additionalMetadata, Attachment fileDetail) {
+ // TODO: Implement...
+
+ return null;
+ }
+
+}
+
diff --git a/samples/client/petstore/jaxrs-cxf-client/src/main/java/io/swagger/api/impl/StoreApiServiceImpl.java b/samples/client/petstore/jaxrs-cxf-client/src/main/java/io/swagger/api/impl/StoreApiServiceImpl.java
new file mode 100644
index 00000000000..3f791097b6b
--- /dev/null
+++ b/samples/client/petstore/jaxrs-cxf-client/src/main/java/io/swagger/api/impl/StoreApiServiceImpl.java
@@ -0,0 +1,46 @@
+package io.swagger.api.impl;
+
+import io.swagger.api.*;
+import java.util.Map;
+import io.swagger.model.Order;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.List;
+import java.util.Map;
+import javax.ws.rs.*;
+import javax.ws.rs.core.Response;
+import org.apache.cxf.jaxrs.model.wadl.Description;
+import org.apache.cxf.jaxrs.model.wadl.DocTarget;
+
+import org.apache.cxf.jaxrs.ext.multipart.*;
+
+import io.swagger.annotations.Api;
+
+public class StoreApiServiceImpl implements StoreApi {
+ public void deleteOrder(String orderId) {
+ // TODO: Implement...
+
+
+ }
+
+ public Map getInventory() {
+ // TODO: Implement...
+
+ return null;
+ }
+
+ public Order getOrderById(Long orderId) {
+ // TODO: Implement...
+
+ return null;
+ }
+
+ public Order placeOrder(Order body) {
+ // TODO: Implement...
+
+ return null;
+ }
+
+}
+
diff --git a/samples/client/petstore/jaxrs-cxf-client/src/main/java/io/swagger/api/impl/UserApiServiceImpl.java b/samples/client/petstore/jaxrs-cxf-client/src/main/java/io/swagger/api/impl/UserApiServiceImpl.java
new file mode 100644
index 00000000000..861273cfb7b
--- /dev/null
+++ b/samples/client/petstore/jaxrs-cxf-client/src/main/java/io/swagger/api/impl/UserApiServiceImpl.java
@@ -0,0 +1,70 @@
+package io.swagger.api.impl;
+
+import io.swagger.api.*;
+import java.util.List;
+import io.swagger.model.User;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.List;
+import java.util.Map;
+import javax.ws.rs.*;
+import javax.ws.rs.core.Response;
+import org.apache.cxf.jaxrs.model.wadl.Description;
+import org.apache.cxf.jaxrs.model.wadl.DocTarget;
+
+import org.apache.cxf.jaxrs.ext.multipart.*;
+
+import io.swagger.annotations.Api;
+
+public class UserApiServiceImpl implements UserApi {
+ public void createUser(User body) {
+ // TODO: Implement...
+
+
+ }
+
+ public void createUsersWithArrayInput(List body) {
+ // TODO: Implement...
+
+
+ }
+
+ public void createUsersWithListInput(List body) {
+ // TODO: Implement...
+
+
+ }
+
+ public void deleteUser(String username) {
+ // TODO: Implement...
+
+
+ }
+
+ public User getUserByName(String username) {
+ // TODO: Implement...
+
+ return null;
+ }
+
+ public String loginUser(String username, String password) {
+ // TODO: Implement...
+
+ return null;
+ }
+
+ public void logoutUser() {
+ // TODO: Implement...
+
+
+ }
+
+ public void updateUser(String username, User body) {
+ // TODO: Implement...
+
+
+ }
+
+}
+
diff --git a/samples/client/petstore/jaxrs-cxf-client/src/test/java/io/swagger/api/PetApiTest.java b/samples/client/petstore/jaxrs-cxf-client/src/test/java/io/swagger/api/PetApiTest.java
new file mode 100644
index 00000000000..b7a13f76849
--- /dev/null
+++ b/samples/client/petstore/jaxrs-cxf-client/src/test/java/io/swagger/api/PetApiTest.java
@@ -0,0 +1,221 @@
+/**
+ * Swagger Petstore
+ * 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.
+ *
+ * OpenAPI spec version: 1.0.0
+ * Contact: apiteam@swagger.io
+ *
+ * NOTE: This class is auto generated by the swagger code generator program.
+ * https://github.com/swagger-api/swagger-codegen.git
+ * Do not edit the class manually.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package io.swagger.api;
+
+import java.io.File;
+import io.swagger.model.ModelApiResponse;
+import io.swagger.model.Pet;
+import org.junit.Test;
+import org.junit.Before;
+import static org.junit.Assert.*;
+
+import javax.ws.rs.core.Response;
+import org.apache.cxf.jaxrs.client.JAXRSClientFactory;
+import org.apache.cxf.jaxrs.client.ClientConfiguration;
+import org.apache.cxf.jaxrs.client.WebClient;
+
+
+import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+
+
+
+/**
+ * API tests for PetApi
+ */
+public class PetApiTest {
+
+
+ private PetApi api;
+
+ @Before
+ public void setup() {
+ JacksonJsonProvider provider = new JacksonJsonProvider();
+ List providers = new ArrayList();
+ providers.add(provider);
+
+ api = JAXRSClientFactory.create("http://petstore.swagger.io/v2", PetApi.class, providers);
+ org.apache.cxf.jaxrs.client.Client client = WebClient.client(api);
+
+ ClientConfiguration config = WebClient.getConfig(client);
+ }
+
+
+ /**
+ * Add a new pet to the store
+ *
+ *
+ *
+ * @throws ApiException
+ * if the Api call fails
+ */
+ @Test
+ public void addPetTest() {
+ Pet body = null;
+ //api.addPet(body);
+
+ // TODO: test validations
+
+
+ }
+
+ /**
+ * Deletes a pet
+ *
+ *
+ *
+ * @throws ApiException
+ * if the Api call fails
+ */
+ @Test
+ public void deletePetTest() {
+ Long petId = null;
+ String apiKey = null;
+ //api.deletePet(petId, apiKey);
+
+ // TODO: test validations
+
+
+ }
+
+ /**
+ * Finds Pets by status
+ *
+ * Multiple status values can be provided with comma separated strings
+ *
+ * @throws ApiException
+ * if the Api call fails
+ */
+ @Test
+ public void findPetsByStatusTest() {
+ List status = null;
+ //List response = api.findPetsByStatus(status);
+ //assertNotNull(response);
+ // TODO: test validations
+
+
+ }
+
+ /**
+ * Finds Pets by tags
+ *
+ * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
+ *
+ * @throws ApiException
+ * if the Api call fails
+ */
+ @Test
+ public void findPetsByTagsTest() {
+ List tags = null;
+ //List response = api.findPetsByTags(tags);
+ //assertNotNull(response);
+ // TODO: test validations
+
+
+ }
+
+ /**
+ * Find pet by ID
+ *
+ * Returns a single pet
+ *
+ * @throws ApiException
+ * if the Api call fails
+ */
+ @Test
+ public void getPetByIdTest() {
+ Long petId = null;
+ //Pet response = api.getPetById(petId);
+ //assertNotNull(response);
+ // TODO: test validations
+
+
+ }
+
+ /**
+ * Update an existing pet
+ *
+ *
+ *
+ * @throws ApiException
+ * if the Api call fails
+ */
+ @Test
+ public void updatePetTest() {
+ Pet body = null;
+ //api.updatePet(body);
+
+ // TODO: test validations
+
+
+ }
+
+ /**
+ * Updates a pet in the store with form data
+ *
+ *
+ *
+ * @throws ApiException
+ * if the Api call fails
+ */
+ @Test
+ public void updatePetWithFormTest() {
+ Long petId = null;
+ String name = null;
+ String status = null;
+ //api.updatePetWithForm(petId, name, status);
+
+ // TODO: test validations
+
+
+ }
+
+ /**
+ * uploads an image
+ *
+ *
+ *
+ * @throws ApiException
+ * if the Api call fails
+ */
+ @Test
+ public void uploadFileTest() {
+ Long petId = null;
+ String additionalMetadata = null;
+ org.apache.cxf.jaxrs.ext.multipart.Attachment file = null;
+ //ModelApiResponse response = api.uploadFile(petId, additionalMetadata, file);
+ //assertNotNull(response);
+ // TODO: test validations
+
+
+ }
+
+}
diff --git a/samples/client/petstore/jaxrs-cxf-client/src/test/java/io/swagger/api/StoreApiTest.java b/samples/client/petstore/jaxrs-cxf-client/src/test/java/io/swagger/api/StoreApiTest.java
new file mode 100644
index 00000000000..92bb0e8b8f9
--- /dev/null
+++ b/samples/client/petstore/jaxrs-cxf-client/src/test/java/io/swagger/api/StoreApiTest.java
@@ -0,0 +1,142 @@
+/**
+ * Swagger Petstore
+ * 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.
+ *
+ * OpenAPI spec version: 1.0.0
+ * Contact: apiteam@swagger.io
+ *
+ * NOTE: This class is auto generated by the swagger code generator program.
+ * https://github.com/swagger-api/swagger-codegen.git
+ * Do not edit the class manually.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package io.swagger.api;
+
+import java.util.Map;
+import io.swagger.model.Order;
+import org.junit.Test;
+import org.junit.Before;
+import static org.junit.Assert.*;
+
+import javax.ws.rs.core.Response;
+import org.apache.cxf.jaxrs.client.JAXRSClientFactory;
+import org.apache.cxf.jaxrs.client.ClientConfiguration;
+import org.apache.cxf.jaxrs.client.WebClient;
+
+
+import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+
+
+
+/**
+ * API tests for StoreApi
+ */
+public class StoreApiTest {
+
+
+ private StoreApi api;
+
+ @Before
+ public void setup() {
+ JacksonJsonProvider provider = new JacksonJsonProvider();
+ List providers = new ArrayList();
+ providers.add(provider);
+
+ api = JAXRSClientFactory.create("http://petstore.swagger.io/v2", StoreApi.class, providers);
+ org.apache.cxf.jaxrs.client.Client client = WebClient.client(api);
+
+ ClientConfiguration config = WebClient.getConfig(client);
+ }
+
+
+ /**
+ * Delete purchase order by ID
+ *
+ * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
+ *
+ * @throws ApiException
+ * if the Api call fails
+ */
+ @Test
+ public void deleteOrderTest() {
+ String orderId = null;
+ //api.deleteOrder(orderId);
+
+ // TODO: test validations
+
+
+ }
+
+ /**
+ * Returns pet inventories by status
+ *
+ * Returns a map of status codes to quantities
+ *
+ * @throws ApiException
+ * if the Api call fails
+ */
+ @Test
+ public void getInventoryTest() {
+ //Map response = api.getInventory();
+ //assertNotNull(response);
+ // TODO: test validations
+
+
+ }
+
+ /**
+ * Find purchase order by ID
+ *
+ * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
+ *
+ * @throws ApiException
+ * if the Api call fails
+ */
+ @Test
+ public void getOrderByIdTest() {
+ Long orderId = null;
+ //Order response = api.getOrderById(orderId);
+ //assertNotNull(response);
+ // TODO: test validations
+
+
+ }
+
+ /**
+ * Place an order for a pet
+ *
+ *
+ *
+ * @throws ApiException
+ * if the Api call fails
+ */
+ @Test
+ public void placeOrderTest() {
+ Order body = null;
+ //Order response = api.placeOrder(body);
+ //assertNotNull(response);
+ // TODO: test validations
+
+
+ }
+
+}
diff --git a/samples/client/petstore/jaxrs-cxf-client/src/test/java/io/swagger/api/UserApiTest.java b/samples/client/petstore/jaxrs-cxf-client/src/test/java/io/swagger/api/UserApiTest.java
new file mode 100644
index 00000000000..a0ecb1dbee2
--- /dev/null
+++ b/samples/client/petstore/jaxrs-cxf-client/src/test/java/io/swagger/api/UserApiTest.java
@@ -0,0 +1,216 @@
+/**
+ * Swagger Petstore
+ * 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.
+ *
+ * OpenAPI spec version: 1.0.0
+ * Contact: apiteam@swagger.io
+ *
+ * NOTE: This class is auto generated by the swagger code generator program.
+ * https://github.com/swagger-api/swagger-codegen.git
+ * Do not edit the class manually.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package io.swagger.api;
+
+import java.util.List;
+import io.swagger.model.User;
+import org.junit.Test;
+import org.junit.Before;
+import static org.junit.Assert.*;
+
+import javax.ws.rs.core.Response;
+import org.apache.cxf.jaxrs.client.JAXRSClientFactory;
+import org.apache.cxf.jaxrs.client.ClientConfiguration;
+import org.apache.cxf.jaxrs.client.WebClient;
+
+
+import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+
+
+
+/**
+ * API tests for UserApi
+ */
+public class UserApiTest {
+
+
+ private UserApi api;
+
+ @Before
+ public void setup() {
+ JacksonJsonProvider provider = new JacksonJsonProvider();
+ List providers = new ArrayList();
+ providers.add(provider);
+
+ api = JAXRSClientFactory.create("http://petstore.swagger.io/v2", UserApi.class, providers);
+ org.apache.cxf.jaxrs.client.Client client = WebClient.client(api);
+
+ ClientConfiguration config = WebClient.getConfig(client);
+ }
+
+
+ /**
+ * Create user
+ *
+ * This can only be done by the logged in user.
+ *
+ * @throws ApiException
+ * if the Api call fails
+ */
+ @Test
+ public void createUserTest() {
+ User body = null;
+ //api.createUser(body);
+
+ // TODO: test validations
+
+
+ }
+
+ /**
+ * Creates list of users with given input array
+ *
+ *
+ *
+ * @throws ApiException
+ * if the Api call fails
+ */
+ @Test
+ public void createUsersWithArrayInputTest() {
+ List body = null;
+ //api.createUsersWithArrayInput(body);
+
+ // TODO: test validations
+
+
+ }
+
+ /**
+ * Creates list of users with given input array
+ *
+ *
+ *
+ * @throws ApiException
+ * if the Api call fails
+ */
+ @Test
+ public void createUsersWithListInputTest() {
+ List body = null;
+ //api.createUsersWithListInput(body);
+
+ // TODO: test validations
+
+
+ }
+
+ /**
+ * Delete user
+ *
+ * This can only be done by the logged in user.
+ *
+ * @throws ApiException
+ * if the Api call fails
+ */
+ @Test
+ public void deleteUserTest() {
+ String username = null;
+ //api.deleteUser(username);
+
+ // TODO: test validations
+
+
+ }
+
+ /**
+ * Get user by user name
+ *
+ *
+ *
+ * @throws ApiException
+ * if the Api call fails
+ */
+ @Test
+ public void getUserByNameTest() {
+ String username = null;
+ //User response = api.getUserByName(username);
+ //assertNotNull(response);
+ // TODO: test validations
+
+
+ }
+
+ /**
+ * Logs user into the system
+ *
+ *
+ *
+ * @throws ApiException
+ * if the Api call fails
+ */
+ @Test
+ public void loginUserTest() {
+ String username = null;
+ String password = null;
+ //String response = api.loginUser(username, password);
+ //assertNotNull(response);
+ // TODO: test validations
+
+
+ }
+
+ /**
+ * Logs out current logged in user session
+ *
+ *
+ *
+ * @throws ApiException
+ * if the Api call fails
+ */
+ @Test
+ public void logoutUserTest() {
+ //api.logoutUser();
+
+ // TODO: test validations
+
+
+ }
+
+ /**
+ * Updated user
+ *
+ * This can only be done by the logged in user.
+ *
+ * @throws ApiException
+ * if the Api call fails
+ */
+ @Test
+ public void updateUserTest() {
+ String username = null;
+ User body = null;
+ //api.updateUser(username, body);
+
+ // TODO: test validations
+
+
+ }
+
+}
diff --git a/samples/client/petstore/jaxrs-cxf/pom.xml b/samples/client/petstore/jaxrs-cxf/pom.xml
index a9bc519ccb8..6d5cf8442e7 100644
--- a/samples/client/petstore/jaxrs-cxf/pom.xml
+++ b/samples/client/petstore/jaxrs-cxf/pom.xml
@@ -136,6 +136,18 @@
${cxf-version}
compile
+
+ com.fasterxml.jackson.jaxrs
+ jackson-jaxrs-json-provider
+ ${jackson-jaxrs-version}
+ compile
+
+
+ com.fasterxml.jackson.datatype
+ jackson-datatype-joda
+ ${jackson-jaxrs-version}
+ compile
+
@@ -150,13 +162,14 @@
1.7
${java.version}
${java.version}
- 1.5.9
+ 1.5.12
9.2.9.v20150224
2.22.2
4.12
1.1.7
2.5
3.1.6
+ 2.8.4
UTF-8
diff --git a/samples/client/petstore/scala/pom.xml b/samples/client/petstore/scala/pom.xml
index 27055cbbdc6..e61ecd8f0f9 100644
--- a/samples/client/petstore/scala/pom.xml
+++ b/samples/client/petstore/scala/pom.xml
@@ -156,6 +156,11 @@
jackson-module-scala_2.10
${jackson-version}
+
+ com.fasterxml.jackson.datatype
+ jackson-datatype-joda
+ ${jackson-version}
+
com.sun.jersey
jersey-client
@@ -210,7 +215,7 @@
1.2
2.2
1.19
- 1.5.9
+ 1.5.12
1.0.5
1.0.0
2.4.2
diff --git a/samples/server/petstore/haskell-servant/client/Main.hs b/samples/server/petstore/haskell-servant/client/Main.hs
deleted file mode 100644
index 718a8587989..00000000000
--- a/samples/server/petstore/haskell-servant/client/Main.hs
+++ /dev/null
@@ -1,35 +0,0 @@
-{-# LANGUAGE DataKinds #-}
-{-# LANGUAGE DeriveGeneric #-}
-{-# LANGUAGE TypeOperators #-}
-
-module Main where
-
-import Control.Monad (void)
-import Control.Monad.Trans.Either
-import Control.Monad.IO.Class
-import Servant.API
-import Servant.Client
-
-import Data.List.Split (splitOn)
-import Network.URI (URI (..), URIAuth (..), parseURI)
-import Data.Maybe (fromMaybe)
-import Test.QuickCheck
-import Control.Monad
-import Model.User
-import Model.Category
-import Model.Pet
-import Model.Tag
-import Model.Order
-import Api.UserApi
-import Api.PetApi
-import Api.StoreApi
-
--- userClient :: IO ()
--- userClient = do
--- users <- sample' (arbitrary :: Gen String)
--- let user = last users
--- void . runEitherT $ do
--- getUserByName user >>= (liftIO . putStrLn . show)
-
-main :: IO ()
-main = putStrLn "Hello Server!"
diff --git a/samples/server/petstore/haskell-servant/haskell-servant-codegen.cabal b/samples/server/petstore/haskell-servant/haskell-servant-codegen.cabal
deleted file mode 100644
index 9347cee563c..00000000000
--- a/samples/server/petstore/haskell-servant/haskell-servant-codegen.cabal
+++ /dev/null
@@ -1,64 +0,0 @@
-name: haskell-servant-codegen
-version: 0.1.0.0
-synopsis: Swagger-codegen example for Haskell servant
-description: Please see README.md
-homepage: https://github.com/swagger-api/swagger-codegen#readme
-license: Apache-2.0
-license-file: LICENSE
-author: Masahiro Yamauchi
-maintainer: sgt.yamauchi@gmail.com
-copyright: 2015- Masahiro Yamauchi
-category: Web
-build-type: Simple
--- extra-source-files:
-cabal-version: >=1.10
-
-library
- hs-source-dirs: lib
- exposed-modules: Utils
- , Model.User
- , Model.Category
- , Model.Pet
- , Model.Tag
- , Model.Order
- , Api.UserApi
- , Api.PetApi
- , Api.StoreApi
- , Apis
- ghc-options: -Wall
- build-depends: base
- , aeson
- , text
- , split
- , containers
- , network-uri
- , QuickCheck
- , servant
- , servant-client
- default-language: Haskell2010
-
-executable client
- hs-source-dirs: client
- main-is: Main.hs
- ghc-options: -threaded -rtsopts -with-rtsopts=-N
- build-depends: base
- , either
- , transformers
- , split
- , network-uri
- , QuickCheck
- , servant
- , servant-client
- , haskell-servant-codegen
- default-language: Haskell2010
-
-executable server
- hs-source-dirs: server
- main-is: Main.hs
- ghc-options: -threaded -rtsopts -with-rtsopts=-N
- build-depends: base
- , warp
- , servant-server
- , servant-mock
- , haskell-servant-codegen
- default-language: Haskell2010
diff --git a/samples/server/petstore/haskell-servant/lib/Api/PetApi.hs b/samples/server/petstore/haskell-servant/lib/Api/PetApi.hs
deleted file mode 100644
index 62c71f26ec9..00000000000
--- a/samples/server/petstore/haskell-servant/lib/Api/PetApi.hs
+++ /dev/null
@@ -1,113 +0,0 @@
-{-# LANGUAGE DataKinds #-}
-{-# LANGUAGE TypeFamilies #-}
-{-# LANGUAGE DeriveGeneric #-}
-{-# LANGUAGE TypeOperators #-}
-{-# LANGUAGE FlexibleInstances #-}
-{-# LANGUAGE OverloadedStrings #-}
-
-module Api.PetApi (
- updatePet
- , addPet
- , findPetsByStatus
- , findPetsByTags
- , getPetById
- , updatePetWithForm
- , deletePet
- , uploadFile
- , getPetByIdWithByteArray
- , addPetUsingByteArray
- , proxyPetApi
- , PetApi
- ) where
-
-import GHC.Generics
-import Data.Proxy
-import Servant.API
-import Servant.Client
-import Network.URI (URI (..), URIAuth (..), parseURI)
-import Data.Maybe (fromMaybe)
-import Servant.Common.Text
-import Data.List (intercalate)
-import qualified Data.Text as T
-import Utils
-import Test.QuickCheck
-import Model.Pet
-import Model.Binary
-
-
-
-
-
-
-data Formnamestatus = Formnamestatus
- { name :: String
- , status :: String
- } deriving (Show, Eq, Generic)
-
-instance FromFormUrlEncoded Formnamestatus where
- fromFormUrlEncoded inputs = Formnamestatus <$> lkp inputs "name" <*> lkp inputs "status"
-instance ToFormUrlEncoded Formnamestatus where
- toFormUrlEncoded x = [((T.pack $ show $ Api.PetApi.name x), (T.pack $ show $ Api.PetApi.status x))]
-instance Arbitrary Formnamestatus where
- arbitrary = Formnamestatus <$> arbitrary <*> arbitrary
-
-
-data FormadditionalMetadatafile = FormadditionalMetadatafile
- { additionalMetadata :: String
- , file :: FilePath
- } deriving (Show, Eq, Generic)
-
-instance FromFormUrlEncoded FormadditionalMetadatafile where
- fromFormUrlEncoded inputs = FormadditionalMetadatafile <$> lkp inputs "additionalMetadata" <*> lkp inputs "file"
-instance ToFormUrlEncoded FormadditionalMetadatafile where
- toFormUrlEncoded x = [((T.pack $ show $ Api.PetApi.additionalMetadata x), (T.pack $ show $ Api.PetApi.file x))]
-instance Arbitrary FormadditionalMetadatafile where
- arbitrary = FormadditionalMetadatafile <$> arbitrary <*> arbitrary
-
-
-
-
-type PetApi = "pet" :> ReqBody '[JSON] Pet :> Put '[JSON] () -- updatePet
- :<|> "pet" :> ReqBody '[JSON] Pet :> Post '[JSON] () -- addPet
- :<|> "pet" :> "findByStatus" :> QueryParam "status" [String] :> Get '[JSON] [Pet] -- findPetsByStatus
- :<|> "pet" :> "findByTags" :> QueryParam "tags" [String] :> Get '[JSON] [Pet] -- findPetsByTags
- :<|> "pet" :> Capture "petId" Integer :> Get '[JSON] Pet -- getPetById
- :<|> "pet" :> Capture "petId" String :> ReqBody '[FormUrlEncoded] Formnamestatus :> Post '[JSON] () -- updatePetWithForm
- :<|> "pet" :> Capture "petId" Integer :> Header "api_key" String :> Delete '[JSON] () -- deletePet
- :<|> "pet" :> Capture "petId" Integer :> "uploadImage" :> ReqBody '[FormUrlEncoded] FormadditionalMetadatafile :> Post '[JSON] () -- uploadFile
- :<|> "pet" :> Capture "petId" Integer?testing_byte_array=true :> Get '[JSON] Binary -- getPetByIdWithByteArray
- :<|> "pet?testing_byte_array=true" :> ReqBody '[JSON] Binary :> Post '[JSON] () -- addPetUsingByteArray
-
-proxyPetApi :: Proxy PetApi
-proxyPetApi = Proxy
-
-
-serverPath :: String
-serverPath = "http://petstore.swagger.io/v2"
-
-parseHostPort :: String -> (String, Int)
-parseHostPort path = (host,port)
- where
- authority = case parseURI path of
- Just x -> uriAuthority x
- _ -> Nothing
- (host, port) = case authority of
- Just y -> (uriRegName y, (getPort . uriPort) y)
- _ -> ("localhost", 8080)
- getPort p = case (length p) of
- 0 -> 80
- _ -> (read . drop 1) p
-
-(host, port) = parseHostPort serverPath
-
-updatePet
- :<|> addPet
- :<|> findPetsByStatus
- :<|> findPetsByTags
- :<|> getPetById
- :<|> updatePetWithForm
- :<|> deletePet
- :<|> uploadFile
- :<|> getPetByIdWithByteArray
- :<|> addPetUsingByteArray
- = client proxyPetApi $ BaseUrl Http host port
diff --git a/samples/server/petstore/haskell-servant/lib/Api/StoreApi.hs b/samples/server/petstore/haskell-servant/lib/Api/StoreApi.hs
deleted file mode 100644
index 819da1e5a05..00000000000
--- a/samples/server/petstore/haskell-servant/lib/Api/StoreApi.hs
+++ /dev/null
@@ -1,67 +0,0 @@
-{-# LANGUAGE DataKinds #-}
-{-# LANGUAGE TypeFamilies #-}
-{-# LANGUAGE DeriveGeneric #-}
-{-# LANGUAGE TypeOperators #-}
-{-# LANGUAGE FlexibleInstances #-}
-{-# LANGUAGE OverloadedStrings #-}
-
-module Api.StoreApi (
- getInventory
- , placeOrder
- , getOrderById
- , deleteOrder
- , proxyStoreApi
- , StoreApi
- ) where
-
-import GHC.Generics
-import Data.Proxy
-import Servant.API
-import Servant.Client
-import Network.URI (URI (..), URIAuth (..), parseURI)
-import Data.Maybe (fromMaybe)
-import Servant.Common.Text
-import Data.List (intercalate)
-import qualified Data.Text as T
-import Utils
-import Test.QuickCheck
-import qualified Data.Map as Map
-import Model.Order
-
-
-
-
-
-
-type StoreApi = "store" :> "inventory" :> Get '[JSON] (Map.Map String Integer) -- getInventory
- :<|> "store" :> "order" :> ReqBody '[JSON] Order :> Post '[JSON] Order -- placeOrder
- :<|> "store" :> "order" :> Capture "orderId" String :> Get '[JSON] Order -- getOrderById
- :<|> "store" :> "order" :> Capture "orderId" String :> Delete '[JSON] () -- deleteOrder
-
-proxyStoreApi :: Proxy StoreApi
-proxyStoreApi = Proxy
-
-
-serverPath :: String
-serverPath = "http://petstore.swagger.io/v2"
-
-parseHostPort :: String -> (String, Int)
-parseHostPort path = (host,port)
- where
- authority = case parseURI path of
- Just x -> uriAuthority x
- _ -> Nothing
- (host, port) = case authority of
- Just y -> (uriRegName y, (getPort . uriPort) y)
- _ -> ("localhost", 8080)
- getPort p = case (length p) of
- 0 -> 80
- _ -> (read . drop 1) p
-
-(host, port) = parseHostPort serverPath
-
-getInventory
- :<|> placeOrder
- :<|> getOrderById
- :<|> deleteOrder
- = client proxyStoreApi $ BaseUrl Http host port
diff --git a/samples/server/petstore/haskell-servant/lib/Api/UserApi.hs b/samples/server/petstore/haskell-servant/lib/Api/UserApi.hs
deleted file mode 100644
index b7c0ad638c5..00000000000
--- a/samples/server/petstore/haskell-servant/lib/Api/UserApi.hs
+++ /dev/null
@@ -1,82 +0,0 @@
-{-# LANGUAGE DataKinds #-}
-{-# LANGUAGE TypeFamilies #-}
-{-# LANGUAGE DeriveGeneric #-}
-{-# LANGUAGE TypeOperators #-}
-{-# LANGUAGE FlexibleInstances #-}
-{-# LANGUAGE OverloadedStrings #-}
-
-module Api.UserApi (
- createUser
- , createUsersWithArrayInput
- , createUsersWithListInput
- , loginUser
- , logoutUser
- , getUserByName
- , updateUser
- , deleteUser
- , proxyUserApi
- , UserApi
- ) where
-
-import GHC.Generics
-import Data.Proxy
-import Servant.API
-import Servant.Client
-import Network.URI (URI (..), URIAuth (..), parseURI)
-import Data.Maybe (fromMaybe)
-import Servant.Common.Text
-import Data.List (intercalate)
-import qualified Data.Text as T
-import Utils
-import Test.QuickCheck
-import Model.User
-
-
-
-
-
-
-
-
-
-
-type UserApi = "user" :> ReqBody '[JSON] User :> Post '[JSON] () -- createUser
- :<|> "user" :> "createWithArray" :> ReqBody '[JSON] [User] :> Post '[JSON] () -- createUsersWithArrayInput
- :<|> "user" :> "createWithList" :> ReqBody '[JSON] [User] :> Post '[JSON] () -- createUsersWithListInput
- :<|> "user" :> "login" :> QueryParam "username" String :> QueryParam "password" String :> Get '[JSON] String -- loginUser
- :<|> "user" :> "logout" :> Get '[JSON] () -- logoutUser
- :<|> "user" :> Capture "username" String :> Get '[JSON] User -- getUserByName
- :<|> "user" :> Capture "username" String :> ReqBody '[JSON] User :> Put '[JSON] () -- updateUser
- :<|> "user" :> Capture "username" String :> Delete '[JSON] () -- deleteUser
-
-proxyUserApi :: Proxy UserApi
-proxyUserApi = Proxy
-
-
-serverPath :: String
-serverPath = "http://petstore.swagger.io/v2"
-
-parseHostPort :: String -> (String, Int)
-parseHostPort path = (host,port)
- where
- authority = case parseURI path of
- Just x -> uriAuthority x
- _ -> Nothing
- (host, port) = case authority of
- Just y -> (uriRegName y, (getPort . uriPort) y)
- _ -> ("localhost", 8080)
- getPort p = case (length p) of
- 0 -> 80
- _ -> (read . drop 1) p
-
-(host, port) = parseHostPort serverPath
-
-createUser
- :<|> createUsersWithArrayInput
- :<|> createUsersWithListInput
- :<|> loginUser
- :<|> logoutUser
- :<|> getUserByName
- :<|> updateUser
- :<|> deleteUser
- = client proxyUserApi $ BaseUrl Http host port
diff --git a/samples/server/petstore/haskell-servant/lib/Apis.hs b/samples/server/petstore/haskell-servant/lib/Apis.hs
deleted file mode 100644
index 1add14160d4..00000000000
--- a/samples/server/petstore/haskell-servant/lib/Apis.hs
+++ /dev/null
@@ -1,24 +0,0 @@
-{-# LANGUAGE DataKinds #-}
-{-# LANGUAGE TypeFamilies #-}
-{-# LANGUAGE DeriveGeneric #-}
-{-# LANGUAGE TypeOperators #-}
-{-# LANGUAGE FlexibleInstances #-}
-module Apis (
- api
- , API
- ) where
-
-import Api.UserApi (UserApi)
-import Api.PetApi (PetApi)
-import Api.StoreApi (StoreApi)
-
-import Data.Proxy
-import Servant.API
-import Test.QuickCheck
-import qualified Data.Map as Map
-import Utils
-
-type API = UserApi :<|> PetApi :<|> StoreApi
-
-api :: Proxy API
-api = Proxy
diff --git a/samples/server/petstore/haskell-servant/lib/Model/Category.hs b/samples/server/petstore/haskell-servant/lib/Model/Category.hs
deleted file mode 100644
index 2d7d90776b2..00000000000
--- a/samples/server/petstore/haskell-servant/lib/Model/Category.hs
+++ /dev/null
@@ -1,24 +0,0 @@
-{-# LANGUAGE DataKinds #-}
-{-# LANGUAGE DeriveGeneric #-}
-{-# LANGUAGE TypeOperators #-}
-{-# LANGUAGE OverloadedStrings #-}
-{-# LANGUAGE GeneralizedNewtypeDeriving #-}
-
-module Model.Category
- ( Category (..)
- ) where
-
-import Data.Aeson
-import GHC.Generics
-import Test.QuickCheck
-
-
-data Category = Category
- { id_ :: Integer
- , name :: String
- } deriving (Show, Eq, Generic)
-
-instance FromJSON Category
-instance ToJSON Category
-instance Arbitrary Category where
- arbitrary = Category <$> arbitrary <*> arbitrary
diff --git a/samples/server/petstore/haskell-servant/lib/Model/Order.hs b/samples/server/petstore/haskell-servant/lib/Model/Order.hs
deleted file mode 100644
index 5c50f4ad85c..00000000000
--- a/samples/server/petstore/haskell-servant/lib/Model/Order.hs
+++ /dev/null
@@ -1,28 +0,0 @@
-{-# LANGUAGE DataKinds #-}
-{-# LANGUAGE DeriveGeneric #-}
-{-# LANGUAGE TypeOperators #-}
-{-# LANGUAGE OverloadedStrings #-}
-{-# LANGUAGE GeneralizedNewtypeDeriving #-}
-
-module Model.Order
- ( Order (..)
- ) where
-
-import Data.Aeson
-import GHC.Generics
-import Test.QuickCheck
-
-
-data Order = Order
- { id_ :: Integer
- , petId :: Integer
- , quantity :: Integer
- , shipDate :: Integer
- , status :: String
- , complete :: Bool
- } deriving (Show, Eq, Generic)
-
-instance FromJSON Order
-instance ToJSON Order
-instance Arbitrary Order where
- arbitrary = Order <$> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary
diff --git a/samples/server/petstore/haskell-servant/lib/Model/Pet.hs b/samples/server/petstore/haskell-servant/lib/Model/Pet.hs
deleted file mode 100644
index dfe4bb8893a..00000000000
--- a/samples/server/petstore/haskell-servant/lib/Model/Pet.hs
+++ /dev/null
@@ -1,30 +0,0 @@
-{-# LANGUAGE DataKinds #-}
-{-# LANGUAGE DeriveGeneric #-}
-{-# LANGUAGE TypeOperators #-}
-{-# LANGUAGE OverloadedStrings #-}
-{-# LANGUAGE GeneralizedNewtypeDeriving #-}
-
-module Model.Pet
- ( Pet (..)
- ) where
-
-import Data.Aeson
-import GHC.Generics
-import Test.QuickCheck
-import Model.Category
-import Model.Tag
-
-
-data Pet = Pet
- { id_ :: Integer
- , category :: Category
- , name :: String
- , photoUrls :: [String]
- , tags :: [Tag]
- , status :: String
- } deriving (Show, Eq, Generic)
-
-instance FromJSON Pet
-instance ToJSON Pet
-instance Arbitrary Pet where
- arbitrary = Pet <$> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary
diff --git a/samples/server/petstore/haskell-servant/lib/Model/Tag.hs b/samples/server/petstore/haskell-servant/lib/Model/Tag.hs
deleted file mode 100644
index 7bbf8feb9b4..00000000000
--- a/samples/server/petstore/haskell-servant/lib/Model/Tag.hs
+++ /dev/null
@@ -1,24 +0,0 @@
-{-# LANGUAGE DataKinds #-}
-{-# LANGUAGE DeriveGeneric #-}
-{-# LANGUAGE TypeOperators #-}
-{-# LANGUAGE OverloadedStrings #-}
-{-# LANGUAGE GeneralizedNewtypeDeriving #-}
-
-module Model.Tag
- ( Tag (..)
- ) where
-
-import Data.Aeson
-import GHC.Generics
-import Test.QuickCheck
-
-
-data Tag = Tag
- { id_ :: Integer
- , name :: String
- } deriving (Show, Eq, Generic)
-
-instance FromJSON Tag
-instance ToJSON Tag
-instance Arbitrary Tag where
- arbitrary = Tag <$> arbitrary <*> arbitrary
diff --git a/samples/server/petstore/haskell-servant/lib/Model/User.hs b/samples/server/petstore/haskell-servant/lib/Model/User.hs
deleted file mode 100644
index 8ccf875dc7d..00000000000
--- a/samples/server/petstore/haskell-servant/lib/Model/User.hs
+++ /dev/null
@@ -1,30 +0,0 @@
-{-# LANGUAGE DataKinds #-}
-{-# LANGUAGE DeriveGeneric #-}
-{-# LANGUAGE TypeOperators #-}
-{-# LANGUAGE OverloadedStrings #-}
-{-# LANGUAGE GeneralizedNewtypeDeriving #-}
-
-module Model.User
- ( User (..)
- ) where
-
-import Data.Aeson
-import GHC.Generics
-import Test.QuickCheck
-
-
-data User = User
- { id_ :: Integer
- , username :: String
- , firstName :: String
- , lastName :: String
- , email :: String
- , password :: String
- , phone :: String
- , userStatus :: Integer
- } deriving (Show, Eq, Generic)
-
-instance FromJSON User
-instance ToJSON User
-instance Arbitrary User where
- arbitrary = User <$> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary
diff --git a/samples/server/petstore/haskell-servant/lib/SwaggerPetstore/API.hs b/samples/server/petstore/haskell-servant/lib/SwaggerPetstore/API.hs
index 75f53f95395..6b9642f716d 100644
--- a/samples/server/petstore/haskell-servant/lib/SwaggerPetstore/API.hs
+++ b/samples/server/petstore/haskell-servant/lib/SwaggerPetstore/API.hs
@@ -1,75 +1,92 @@
-{-# LANGUAGE DataKinds, TypeFamilies, TypeOperators, FlexibleInstances, OverloadedStrings, ViewPatterns #-}
-{-# LANGUAGE RecordWildCards, GeneralizedNewtypeDeriving, DeriveTraversable, FlexibleContexts, DeriveGeneric #-}
-{-# OPTIONS_GHC -fno-warn-unused-binds -fno-warn-unused-imports -fcontext-stack=328 #-}
-module SwaggerPetstore.API (
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DeriveTraversable #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE RecordWildCards #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE ViewPatterns #-}
+{-# OPTIONS_GHC
+-fno-warn-unused-binds -fno-warn-unused-imports -fcontext-stack=328 #-}
+
+module SwaggerPetstore.API
-- * Client and Server
- ServerConfig(..),
- SwaggerPetstoreBackend,
- createSwaggerPetstoreClient,
- runSwaggerPetstoreServer,
- runSwaggerPetstoreClient,
- runSwaggerPetstoreClientWithManager,
- SwaggerPetstoreClient,
+ ( ServerConfig(..)
+ , SwaggerPetstoreBackend
+ , createSwaggerPetstoreClient
+ , runSwaggerPetstoreServer
+ , runSwaggerPetstoreClient
+ , runSwaggerPetstoreClientWithManager
+ , SwaggerPetstoreClient
-- ** Servant
- SwaggerPetstoreAPI,
+ , SwaggerPetstoreAPI
) where
import SwaggerPetstore.Types
+import Control.Monad.Except (ExceptT)
+import Control.Monad.IO.Class
import Data.Aeson (Value)
import Data.Coerce (coerce)
-import Servant.API
-import Servant (serve, ServantErr)
-import Web.HttpApiData
-import qualified Network.Wai.Handler.Warp as Warp
-import qualified Data.Text as T
-import Data.Text (Text)
-import Servant.Common.BaseUrl(BaseUrl(..))
-import Servant.Client (ServantError, client, Scheme(Http))
-import Data.Proxy (Proxy(..))
-import Control.Monad.IO.Class
import Data.Function ((&))
-import GHC.Exts (IsString(..))
import qualified Data.Map as Map
-import GHC.Generics (Generic)
import Data.Monoid ((<>))
-import Servant.API.Verbs (Verb, StdMethod(..))
-import Control.Monad.Except (ExceptT)
-import Network.HTTP.Client (Manager, newManager, defaultManagerSettings)
+import Data.Proxy (Proxy(..))
+import Data.Text (Text)
+import qualified Data.Text as T
+import GHC.Exts (IsString(..))
+import GHC.Generics (Generic)
+import Network.HTTP.Client (Manager, defaultManagerSettings, newManager)
import Network.HTTP.Types.Method (methodOptions)
-
-instance ReflectMethod 'OPTIONS where
- reflectMethod _ = methodOptions
+import qualified Network.Wai.Handler.Warp as Warp
+import Servant (ServantErr, serve)
+import Servant.API
+import Servant.API.Verbs (StdMethod(..), Verb)
+import Servant.Client (Scheme(Http), ServantError, client)
+import Servant.Common.BaseUrl (BaseUrl(..))
+import Web.HttpApiData
data FormUpdatePetWithForm = FormUpdatePetWithForm
- { updatePetWithFormName :: Text
- , updatePetWithFormStatus :: Text
- } deriving (Show, Eq, Generic)
+ { updatePetWithFormName :: Text
+ , updatePetWithFormStatus :: Text
+ } deriving (Show, Eq, Generic)
instance FromFormUrlEncoded FormUpdatePetWithForm where
- fromFormUrlEncoded inputs = FormUpdatePetWithForm <$> lookupEither "name" inputs <*> lookupEither "status" inputs
-instance ToFormUrlEncoded FormUpdatePetWithForm where
- toFormUrlEncoded value = [("name", toQueryParam $ updatePetWithFormName value), ("status", toQueryParam $ updatePetWithFormStatus value)]
+ fromFormUrlEncoded inputs = FormUpdatePetWithForm <$> lookupEither "name" inputs <*> lookupEither "status" inputs
+instance ToFormUrlEncoded FormUpdatePetWithForm where
+ toFormUrlEncoded value =
+ [ ("name", toQueryParam $ updatePetWithFormName value)
+ , ("status", toQueryParam $ updatePetWithFormStatus value)
+ ]
data FormUploadFile = FormUploadFile
- { uploadFileAdditionalMetadata :: Text
- , uploadFileFile :: FilePath
- } deriving (Show, Eq, Generic)
+ { uploadFileAdditionalMetadata :: Text
+ , uploadFileFile :: FilePath
+ } deriving (Show, Eq, Generic)
instance FromFormUrlEncoded FormUploadFile where
- fromFormUrlEncoded inputs = FormUploadFile <$> lookupEither "additionalMetadata" inputs <*> lookupEither "file" inputs
-instance ToFormUrlEncoded FormUploadFile where
- toFormUrlEncoded value = [("additionalMetadata", toQueryParam $ uploadFileAdditionalMetadata value), ("file", toQueryParam $ uploadFileFile value)]
+ fromFormUrlEncoded inputs = FormUploadFile <$> lookupEither "additionalMetadata" inputs <*> lookupEither "file" inputs
+instance ToFormUrlEncoded FormUploadFile where
+ toFormUrlEncoded value =
+ [ ("additionalMetadata", toQueryParam $ uploadFileAdditionalMetadata value)
+ , ("file", toQueryParam $ uploadFileFile value)
+ ]
-- For the form data code generation.
-lookupEither :: FromHttpApiData b => Text -> [(Text, Text)] -> Either Text b
+lookupEither :: FromHttpApiData b => Text -> [(Text, Text)] -> Either String b
lookupEither key assocs =
case lookup key assocs of
- Nothing -> Left $ "Could not find parameter " <> key <> " in form data"
- Just value -> parseQueryParam value
+ Nothing -> Left $ "Could not find parameter " <> (T.unpack key) <> " in form data"
+ Just value ->
+ case parseQueryParam value of
+ Left result -> Left $ T.unpack result
+ Right result -> Right $ result
-- | Servant type-level API, generated from the Swagger spec for SwaggerPetstore.
type SwaggerPetstoreAPI
@@ -95,54 +112,56 @@ type SwaggerPetstoreAPI
:<|> "user" :> Capture "username" Text :> ReqBody '[JSON] User :> Verb 'PUT 200 '[JSON] () -- 'updateUser' route
-- | Server or client configuration, specifying the host and port to query or serve on.
-data ServerConfig = ServerConfig {
- configHost :: String, -- ^ Hostname to serve on, e.g. "127.0.0.1"
- configPort :: Int -- ^ Port to serve on, e.g. 8080
+data ServerConfig = ServerConfig
+ { configHost :: String -- ^ Hostname to serve on, e.g. "127.0.0.1"
+ , configPort :: Int -- ^ Port to serve on, e.g. 8080
} deriving (Eq, Ord, Show, Read)
-- | List of elements parsed from a query.
-newtype QueryList (p :: CollectionFormat) a = QueryList { fromQueryList :: [a] }
- deriving (Functor, Applicative, Monad, Foldable, Traversable)
+newtype QueryList (p :: CollectionFormat) a = QueryList
+ { fromQueryList :: [a]
+ } deriving (Functor, Applicative, Monad, Foldable, Traversable)
-- | Formats in which a list can be encoded into a HTTP path.
-data CollectionFormat = CommaSeparated -- ^ CSV format for multiple parameters.
- | SpaceSeparated -- ^ Also called "SSV"
- | TabSeparated -- ^ Also called "TSV"
- | PipeSeparated -- ^ `value1|value2|value2`
- | MultiParamArray -- ^ Using multiple GET parameters, e.g. `foo=bar&foo=baz`. Only for GET params.
+data CollectionFormat
+ = CommaSeparated -- ^ CSV format for multiple parameters.
+ | SpaceSeparated -- ^ Also called "SSV"
+ | TabSeparated -- ^ Also called "TSV"
+ | PipeSeparated -- ^ `value1|value2|value2`
+ | MultiParamArray -- ^ Using multiple GET parameters, e.g. `foo=bar&foo=baz`. Only for GET params.
instance FromHttpApiData a => FromHttpApiData (QueryList 'CommaSeparated a) where
- parseQueryParam = parseSeparatedQueryList ','
+ parseQueryParam = parseSeparatedQueryList ','
instance FromHttpApiData a => FromHttpApiData (QueryList 'TabSeparated a) where
- parseQueryParam = parseSeparatedQueryList '\t'
+ parseQueryParam = parseSeparatedQueryList '\t'
instance FromHttpApiData a => FromHttpApiData (QueryList 'SpaceSeparated a) where
- parseQueryParam = parseSeparatedQueryList ' '
+ parseQueryParam = parseSeparatedQueryList ' '
instance FromHttpApiData a => FromHttpApiData (QueryList 'PipeSeparated a) where
- parseQueryParam = parseSeparatedQueryList '|'
+ parseQueryParam = parseSeparatedQueryList '|'
instance FromHttpApiData a => FromHttpApiData (QueryList 'MultiParamArray a) where
- parseQueryParam = error "unimplemented FromHttpApiData for MultiParamArray collection format"
+ parseQueryParam = error "unimplemented FromHttpApiData for MultiParamArray collection format"
parseSeparatedQueryList :: FromHttpApiData a => Char -> Text -> Either Text (QueryList p a)
parseSeparatedQueryList char = fmap QueryList . mapM parseQueryParam . T.split (== char)
instance ToHttpApiData a => ToHttpApiData (QueryList 'CommaSeparated a) where
- toQueryParam = formatSeparatedQueryList ','
+ toQueryParam = formatSeparatedQueryList ','
instance ToHttpApiData a => ToHttpApiData (QueryList 'TabSeparated a) where
- toQueryParam = formatSeparatedQueryList '\t'
+ toQueryParam = formatSeparatedQueryList '\t'
instance ToHttpApiData a => ToHttpApiData (QueryList 'SpaceSeparated a) where
- toQueryParam = formatSeparatedQueryList ' '
+ toQueryParam = formatSeparatedQueryList ' '
instance ToHttpApiData a => ToHttpApiData (QueryList 'PipeSeparated a) where
- toQueryParam = formatSeparatedQueryList '|'
+ toQueryParam = formatSeparatedQueryList '|'
instance ToHttpApiData a => ToHttpApiData (QueryList 'MultiParamArray a) where
- toQueryParam = error "unimplemented ToHttpApiData for MultiParamArray collection format"
+ toQueryParam = error "unimplemented ToHttpApiData for MultiParamArray collection format"
formatSeparatedQueryList :: ToHttpApiData a => Char -> QueryList p a -> Text
formatSeparatedQueryList char = T.intercalate (T.singleton char) . map toQueryParam . fromQueryList
@@ -152,43 +171,46 @@ formatSeparatedQueryList char = T.intercalate (T.singleton char) . map toQueryPa
-- The backend can be used both for the client and the server. The client generated from the SwaggerPetstore Swagger spec
-- is a backend that executes actions by sending HTTP requests (see @createSwaggerPetstoreClient@). Alternatively, provided
-- a backend, the API can be served using @runSwaggerPetstoreServer@.
-data SwaggerPetstoreBackend m = SwaggerPetstoreBackend {
- addPet :: Pet -> m (){- ^ -},
- deletePet :: Integer -> Maybe Text -> m (){- ^ -},
- findPetsByStatus :: Maybe [Text] -> m [Pet]{- ^ Multiple status values can be provided with comma separated strings -},
- findPetsByTags :: Maybe [Text] -> m [Pet]{- ^ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. -},
- getPetById :: Integer -> m Pet{- ^ Returns a single pet -},
- updatePet :: Pet -> m (){- ^ -},
- updatePetWithForm :: Integer -> FormUpdatePetWithForm -> m (){- ^ -},
- uploadFile :: Integer -> FormUploadFile -> m ApiResponse{- ^ -},
- deleteOrder :: Text -> m (){- ^ For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors -},
- getInventory :: m (Map.Map String Int){- ^ Returns a map of status codes to quantities -},
- getOrderById :: Integer -> m Order{- ^ For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions -},
- placeOrder :: Order -> m Order{- ^ -},
- createUser :: User -> m (){- ^ This can only be done by the logged in user. -},
- createUsersWithArrayInput :: [User] -> m (){- ^ -},
- createUsersWithListInput :: [User] -> m (){- ^ -},
- deleteUser :: Text -> m (){- ^ This can only be done by the logged in user. -},
- getUserByName :: Text -> m User{- ^ -},
- loginUser :: Maybe Text -> Maybe Text -> m Text{- ^ -},
- logoutUser :: m (){- ^ -},
- updateUser :: Text -> User -> m (){- ^ This can only be done by the logged in user. -}
+data SwaggerPetstoreBackend m = SwaggerPetstoreBackend
+ { addPet :: Pet -> m (){- ^ -}
+ , deletePet :: Integer -> Maybe Text -> m (){- ^ -}
+ , findPetsByStatus :: Maybe [Text] -> m [Pet]{- ^ Multiple status values can be provided with comma separated strings -}
+ , findPetsByTags :: Maybe [Text] -> m [Pet]{- ^ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. -}
+ , getPetById :: Integer -> m Pet{- ^ Returns a single pet -}
+ , updatePet :: Pet -> m (){- ^ -}
+ , updatePetWithForm :: Integer -> FormUpdatePetWithForm -> m (){- ^ -}
+ , uploadFile :: Integer -> FormUploadFile -> m ApiResponse{- ^ -}
+ , deleteOrder :: Text -> m (){- ^ For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors -}
+ , getInventory :: m (Map.Map String Int){- ^ Returns a map of status codes to quantities -}
+ , getOrderById :: Integer -> m Order{- ^ For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions -}
+ , placeOrder :: Order -> m Order{- ^ -}
+ , createUser :: User -> m (){- ^ This can only be done by the logged in user. -}
+ , createUsersWithArrayInput :: [User] -> m (){- ^ -}
+ , createUsersWithListInput :: [User] -> m (){- ^ -}
+ , deleteUser :: Text -> m (){- ^ This can only be done by the logged in user. -}
+ , getUserByName :: Text -> m User{- ^ -}
+ , loginUser :: Maybe Text -> Maybe Text -> m Text{- ^ -}
+ , logoutUser :: m (){- ^ -}
+ , updateUser :: Text -> User -> m (){- ^ This can only be done by the logged in user. -}
}
-newtype SwaggerPetstoreClient a = SwaggerPetstoreClient { runClient :: Manager -> BaseUrl -> ExceptT ServantError IO a }
- deriving Functor
+newtype SwaggerPetstoreClient a = SwaggerPetstoreClient
+ { runClient :: Manager -> BaseUrl -> ExceptT ServantError IO a
+ } deriving Functor
instance Applicative SwaggerPetstoreClient where
- pure x = SwaggerPetstoreClient (\_ _ -> pure x)
- (SwaggerPetstoreClient f) <*> (SwaggerPetstoreClient x) = SwaggerPetstoreClient (\manager url -> f manager url <*> x manager url)
+ pure x = SwaggerPetstoreClient (\_ _ -> pure x)
+ (SwaggerPetstoreClient f) <*> (SwaggerPetstoreClient x) =
+ SwaggerPetstoreClient (\manager url -> f manager url <*> x manager url)
instance Monad SwaggerPetstoreClient where
- (SwaggerPetstoreClient a) >>= f = SwaggerPetstoreClient (\manager url -> do
- value <- a manager url
- runClient (f value) manager url)
+ (SwaggerPetstoreClient a) >>= f =
+ SwaggerPetstoreClient (\manager url -> do
+ value <- a manager url
+ runClient (f value) manager url)
instance MonadIO SwaggerPetstoreClient where
- liftIO io = SwaggerPetstoreClient (\_ _ -> liftIO io)
+ liftIO io = SwaggerPetstoreClient (\_ _ -> liftIO io)
createSwaggerPetstoreClient :: SwaggerPetstoreBackend SwaggerPetstoreClient
createSwaggerPetstoreClient = SwaggerPetstoreBackend{..}
@@ -229,7 +251,6 @@ runSwaggerPetstoreClientWithManager manager clientConfig cl =
runSwaggerPetstoreServer :: MonadIO m => ServerConfig -> SwaggerPetstoreBackend (ExceptT ServantErr IO) -> m ()
runSwaggerPetstoreServer ServerConfig{..} backend =
liftIO $ Warp.runSettings warpSettings $ serve (Proxy :: Proxy SwaggerPetstoreAPI) (serverFromBackend backend)
-
where
warpSettings = Warp.defaultSettings & Warp.setPort configPort & Warp.setHost (fromString configHost)
serverFromBackend SwaggerPetstoreBackend{..} =
diff --git a/samples/server/petstore/haskell-servant/lib/SwaggerPetstore/Types.hs b/samples/server/petstore/haskell-servant/lib/SwaggerPetstore/Types.hs
index 4207fbc90c6..7a6c6d802f8 100644
--- a/samples/server/petstore/haskell-servant/lib/SwaggerPetstore/Types.hs
+++ b/samples/server/petstore/haskell-servant/lib/SwaggerPetstore/Types.hs
@@ -3,13 +3,13 @@
{-# OPTIONS_GHC -fno-warn-unused-binds -fno-warn-unused-imports #-}
module SwaggerPetstore.Types (
- ApiResponse (..),
- Category (..),
- Order (..),
- Pet (..),
- Tag (..),
- User (..),
- ) where
+ ApiResponse (..),
+ Category (..),
+ Order (..),
+ Pet (..),
+ Tag (..),
+ User (..),
+ ) where
import Data.List (stripPrefix)
import Data.Maybe (fromMaybe)
@@ -22,98 +22,133 @@ import GHC.Generics (Generic)
import Data.Function ((&))
--- |
+-- | Describes the result of uploading an image resource
data ApiResponse = ApiResponse
- { apiResponseCode :: Int -- ^
- , apiResponseType_ :: Text -- ^
- , apiResponseMessage :: Text -- ^
- } deriving (Show, Eq, Generic)
+ { apiResponseCode :: Int -- ^
+ , apiResponseType :: Text -- ^
+ , apiResponseMessage :: Text -- ^
+ } deriving (Show, Eq, Generic)
instance FromJSON ApiResponse where
- parseJSON = genericParseJSON (removeFieldLabelPrefix True "apiResponse")
+ parseJSON = genericParseJSON (removeFieldLabelPrefix True "apiResponse")
instance ToJSON ApiResponse where
- toJSON = genericToJSON (removeFieldLabelPrefix False "apiResponse")
+ toJSON = genericToJSON (removeFieldLabelPrefix False "apiResponse")
--- |
+-- | A category for a pet
data Category = Category
- { categoryId :: Integer -- ^
- , categoryName :: Text -- ^
- } deriving (Show, Eq, Generic)
+ { categoryId :: Integer -- ^
+ , categoryName :: Text -- ^
+ } deriving (Show, Eq, Generic)
instance FromJSON Category where
- parseJSON = genericParseJSON (removeFieldLabelPrefix True "category")
+ parseJSON = genericParseJSON (removeFieldLabelPrefix True "category")
instance ToJSON Category where
- toJSON = genericToJSON (removeFieldLabelPrefix False "category")
+ toJSON = genericToJSON (removeFieldLabelPrefix False "category")
--- |
+-- | An order for a pets from the pet store
data Order = Order
- { orderId :: Integer -- ^
- , orderPetId :: Integer -- ^
- , orderQuantity :: Int -- ^
- , orderShipDate :: Integer -- ^
- , orderStatus :: Text -- ^ Order Status
- , orderComplete :: Bool -- ^
- } deriving (Show, Eq, Generic)
+ { orderId :: Integer -- ^
+ , orderPetId :: Integer -- ^
+ , orderQuantity :: Int -- ^
+ , orderShipDate :: Integer -- ^
+ , orderStatus :: Text -- ^ Order Status
+ , orderComplete :: Bool -- ^
+ } deriving (Show, Eq, Generic)
instance FromJSON Order where
- parseJSON = genericParseJSON (removeFieldLabelPrefix True "order")
+ parseJSON = genericParseJSON (removeFieldLabelPrefix True "order")
instance ToJSON Order where
- toJSON = genericToJSON (removeFieldLabelPrefix False "order")
+ toJSON = genericToJSON (removeFieldLabelPrefix False "order")
--- |
+-- | A pet for sale in the pet store
data Pet = Pet
- { petId :: Integer -- ^
- , petCategory :: Category -- ^
- , petName :: Text -- ^
- , petPhotoUrls :: [Text] -- ^
- , petTags :: [Tag] -- ^
- , petStatus :: Text -- ^ pet status in the store
- } deriving (Show, Eq, Generic)
+ { petId :: Integer -- ^
+ , petCategory :: Category -- ^
+ , petName :: Text -- ^
+ , petPhotoUrls :: [Text] -- ^
+ , petTags :: [Tag] -- ^
+ , petStatus :: Text -- ^ pet status in the store
+ } deriving (Show, Eq, Generic)
instance FromJSON Pet where
- parseJSON = genericParseJSON (removeFieldLabelPrefix True "pet")
+ parseJSON = genericParseJSON (removeFieldLabelPrefix True "pet")
instance ToJSON Pet where
- toJSON = genericToJSON (removeFieldLabelPrefix False "pet")
+ toJSON = genericToJSON (removeFieldLabelPrefix False "pet")
--- |
+-- | A tag for a pet
data Tag = Tag
- { tagId :: Integer -- ^
- , tagName :: Text -- ^
- } deriving (Show, Eq, Generic)
+ { tagId :: Integer -- ^
+ , tagName :: Text -- ^
+ } deriving (Show, Eq, Generic)
instance FromJSON Tag where
- parseJSON = genericParseJSON (removeFieldLabelPrefix True "tag")
+ parseJSON = genericParseJSON (removeFieldLabelPrefix True "tag")
instance ToJSON Tag where
- toJSON = genericToJSON (removeFieldLabelPrefix False "tag")
+ toJSON = genericToJSON (removeFieldLabelPrefix False "tag")
--- |
+-- | A User who is purchasing from the pet store
data User = User
- { userId :: Integer -- ^
- , userUsername :: Text -- ^
- , userFirstName :: Text -- ^
- , userLastName :: Text -- ^
- , userEmail :: Text -- ^
- , userPassword :: Text -- ^
- , userPhone :: Text -- ^
- , userUserStatus :: Int -- ^ User Status
- } deriving (Show, Eq, Generic)
+ { userId :: Integer -- ^
+ , userUsername :: Text -- ^
+ , userFirstName :: Text -- ^
+ , userLastName :: Text -- ^
+ , userEmail :: Text -- ^
+ , userPassword :: Text -- ^
+ , userPhone :: Text -- ^
+ , userUserStatus :: Int -- ^ User Status
+ } deriving (Show, Eq, Generic)
instance FromJSON User where
- parseJSON = genericParseJSON (removeFieldLabelPrefix True "user")
+ parseJSON = genericParseJSON (removeFieldLabelPrefix True "user")
instance ToJSON User where
- toJSON = genericToJSON (removeFieldLabelPrefix False "user")
+ toJSON = genericToJSON (removeFieldLabelPrefix False "user")
-- Remove a field label prefix during JSON parsing.
-- Also perform any replacements for special characters.
removeFieldLabelPrefix :: Bool -> String -> Options
removeFieldLabelPrefix forParsing prefix =
defaultOptions
- { fieldLabelModifier = fromMaybe (error ("did not find prefix " ++ prefix)) . stripPrefix prefix . replaceSpecialChars
- }
+ {fieldLabelModifier = fromMaybe (error ("did not find prefix " ++ prefix)) . stripPrefix prefix . replaceSpecialChars}
where
replaceSpecialChars field = foldl (&) field (map mkCharReplacement specialChars)
- specialChars = [("#", "'Hash"), ("!", "'Exclamation"), ("&", "'Ampersand"), ("@", "'At"), ("$", "'Dollar"), ("%", "'Percent"), ("*", "'Star"), ("+", "'Plus"), (">=", "'Greater_Than_Or_Equal_To"), ("-", "'Dash"), ("<=", "'Less_Than_Or_Equal_To"), ("!=", "'Greater_Than_Or_Equal_To"), (":", "'Colon"), ("^", "'Caret"), ("|", "'Pipe"), (">", "'GreaterThan"), ("=", "'Equal"), ("<", "'LessThan")]
+ specialChars =
+ [ ("@", "'At")
+ , ("\\", "'Back_Slash")
+ , ("<=", "'Less_Than_Or_Equal_To")
+ , ("\"", "'Double_Quote")
+ , ("[", "'Left_Square_Bracket")
+ , ("]", "'Right_Square_Bracket")
+ , ("^", "'Caret")
+ , ("_", "'Underscore")
+ , ("`", "'Backtick")
+ , ("!", "'Exclamation")
+ , ("#", "'Hash")
+ , ("$", "'Dollar")
+ , ("%", "'Percent")
+ , ("&", "'Ampersand")
+ , ("'", "'Quote")
+ , ("(", "'Left_Parenthesis")
+ , (")", "'Right_Parenthesis")
+ , ("*", "'Star")
+ , ("+", "'Plus")
+ , (",", "'Comma")
+ , ("-", "'Dash")
+ , (".", "'Period")
+ , ("/", "'Slash")
+ , (":", "'Colon")
+ , ("{", "'Left_Curly_Bracket")
+ , ("|", "'Pipe")
+ , ("<", "'LessThan")
+ , ("!=", "'Not_Equal")
+ , ("=", "'Equal")
+ , ("}", "'Right_Curly_Bracket")
+ , (">", "'GreaterThan")
+ , ("~", "'Tilde")
+ , ("?", "'Question_Mark")
+ , (">=", "'Greater_Than_Or_Equal_To")
+ ]
mkCharReplacement (replaceStr, searchStr) = T.unpack . replacer (T.pack searchStr) (T.pack replaceStr) . T.pack
- replacer = if forParsing then flip T.replace else T.replace
-
-
+ replacer =
+ if forParsing
+ then flip T.replace
+ else T.replace
diff --git a/samples/server/petstore/haskell-servant/lib/Utils.hs b/samples/server/petstore/haskell-servant/lib/Utils.hs
deleted file mode 100644
index f6db2602ce8..00000000000
--- a/samples/server/petstore/haskell-servant/lib/Utils.hs
+++ /dev/null
@@ -1,27 +0,0 @@
-{-# LANGUAGE DataKinds #-}
-{-# LANGUAGE TypeFamilies #-}
-{-# LANGUAGE DeriveGeneric #-}
-{-# LANGUAGE TypeOperators #-}
-{-# LANGUAGE FlexibleInstances #-}
-module Utils where
-
-import GHC.Generics
-import Servant.API
-import Data.List (intercalate)
-import Data.List.Split (splitOn)
-import qualified Data.Map as Map
-import qualified Data.Text as T
-import Test.QuickCheck
-
-instance FromText [String] where
- fromText = Just . splitOn "," . T.unpack
-
-instance ToText [String] where
- toText = T.pack . intercalate ","
-
-lkp inputs l = case lookup l inputs of
- Nothing -> Left $ "label " ++ T.unpack l ++ " not found"
- Just v -> Right $ read (T.unpack v)
-
-instance (Ord k, Arbitrary k, Arbitrary v) => Arbitrary (Map.Map k v) where
- arbitrary = Map.fromList <$> arbitrary
diff --git a/samples/server/petstore/haskell-servant/server/Main.hs b/samples/server/petstore/haskell-servant/server/Main.hs
deleted file mode 100644
index 68b4ff6ce33..00000000000
--- a/samples/server/petstore/haskell-servant/server/Main.hs
+++ /dev/null
@@ -1,13 +0,0 @@
-{-# LANGUAGE DataKinds #-}
-{-# LANGUAGE DeriveGeneric #-}
-{-# LANGUAGE TypeOperators #-}
-
-module Main where
-
-import Apis
-import Servant
-import Servant.Mock
-import qualified Network.Wai.Handler.Warp as Warp
-
-main :: IO ()
-main = Warp.run 8080 $ serve api (mock api)
diff --git a/samples/server/petstore/haskell-servant/stack.yaml b/samples/server/petstore/haskell-servant/stack.yaml
index bed581391ca..36060148910 100644
--- a/samples/server/petstore/haskell-servant/stack.yaml
+++ b/samples/server/petstore/haskell-servant/stack.yaml
@@ -1,8 +1,8 @@
resolver: lts-5.11
extra-deps:
-- servant-0.6
-- servant-client-0.6
-- servant-server-0.6
-- http-api-data-0.2.2
+- servant-0.8.1
+- servant-client-0.8.1
+- servant-server-0.8.1
+- http-api-data-0.2.4
packages:
- '.'
diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/FakeApi.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/FakeApi.java
index 40d9281a51a..c0d6d86048e 100644
--- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/FakeApi.java
+++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/FakeApi.java
@@ -63,7 +63,7 @@ default ResponseEntity testEndpointParameters(@ApiParam(value = "None", re
produces = { "*/*" },
consumes = { "*/*" },
method = RequestMethod.GET)
- default ResponseEntity testEnumParameters(@ApiParam(value = "Form parameter enum test (string array)" , allowableValues="GREATER_THAN, DOLLAR") @RequestPart(value="enum_form_string_array", required=false) List enumFormStringArray,@ApiParam(value = "Form parameter enum test (string)" , allowableValues="_ABC, _EFG, _XYZ_", defaultValue="-efg") @RequestPart(value="enum_form_string", required=false) String enumFormString,@ApiParam(value = "Header parameter enum test (string array)" , allowableValues="GREATER_THAN, DOLLAR") @RequestHeader(value="enum_header_string_array", required=false) List enumHeaderStringArray,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_ABC, _EFG, _XYZ_", defaultValue="-efg") @RequestHeader(value="enum_header_string", required=false) String enumHeaderString, @ApiParam(value = "Query parameter enum test (string array)", allowableValues = "GREATER_THAN, DOLLAR") @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray, @ApiParam(value = "Query parameter enum test (string)", allowableValues = "_ABC, _EFG, _XYZ_", defaultValue = "-efg") @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString, @ApiParam(value = "Query parameter enum test (double)") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger,@ApiParam(value = "Query parameter enum test (double)" ) @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble) {
+ default ResponseEntity testEnumParameters(@ApiParam(value = "Form parameter enum test (string array)" , allowableValues="GREATER_THAN, DOLLAR") @RequestPart(value="enum_form_string_array", required=false) List enumFormStringArray,@ApiParam(value = "Form parameter enum test (string)" , allowableValues="_ABC, _EFG, _XYZ_", defaultValue="-efg") @RequestPart(value="enum_form_string", required=false) String enumFormString,@ApiParam(value = "Header parameter enum test (string array)" , allowableValues="GREATER_THAN, DOLLAR") @RequestHeader(value="enum_header_string_array", required=false) List enumHeaderStringArray,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_ABC, _EFG, _XYZ_", defaultValue="-efg") @RequestHeader(value="enum_header_string", required=false) String enumHeaderString, @ApiParam(value = "Query parameter enum test (string array)", allowableValues = "GREATER_THAN, DOLLAR") @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray, @ApiParam(value = "Query parameter enum test (string)", allowableValues = "_ABC, _EFG, _XYZ_", defaultValue = "-efg") @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString, @ApiParam(value = "Query parameter enum test (double)", allowableValues = "NUMBER_1, NUMBER_MINUS_2") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger,@ApiParam(value = "Query parameter enum test (double)" , allowableValues="NUMBER_1_DOT_1, NUMBER_MINUS_1_DOT_2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble) {
// do some magic!
return new ResponseEntity(HttpStatus.OK);
}
diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/FakeApiController.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/FakeApiController.java
index 9f5e48caec9..e1baee76ab2 100644
--- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/FakeApiController.java
+++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/FakeApiController.java
@@ -60,8 +60,8 @@ public ResponseEntity testEnumParameters(@ApiParam(value = "Form parameter
@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_ABC, _EFG, _XYZ_", defaultValue="-efg") @RequestHeader(value="enum_header_string", required=false) String enumHeaderString,
@ApiParam(value = "Query parameter enum test (string array)", allowableValues = "GREATER_THAN, DOLLAR") @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray,
@ApiParam(value = "Query parameter enum test (string)", allowableValues = "_ABC, _EFG, _XYZ_", defaultValue = "-efg") @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString,
- @ApiParam(value = "Query parameter enum test (double)") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger,
- @ApiParam(value = "Query parameter enum test (double)" ) @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble) {
+ @ApiParam(value = "Query parameter enum test (double)", allowableValues = "NUMBER_1, NUMBER_MINUS_2") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger,
+ @ApiParam(value = "Query parameter enum test (double)" , allowableValues="NUMBER_1_DOT_1, NUMBER_MINUS_1_DOT_2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble) {
// do some magic!
return delegate.testEnumParameters(enumFormStringArray, enumFormString, enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble);
}
diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/FakeApi.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/FakeApi.java
index ae092a55402..7179c47133f 100644
--- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/FakeApi.java
+++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/FakeApi.java
@@ -56,6 +56,6 @@ public interface FakeApi {
produces = { "*/*" },
consumes = { "*/*" },
method = RequestMethod.GET)
- ResponseEntity testEnumParameters(@ApiParam(value = "Form parameter enum test (string array)" , allowableValues="GREATER_THAN, DOLLAR") @RequestPart(value="enum_form_string_array", required=false) List enumFormStringArray,@ApiParam(value = "Form parameter enum test (string)" , allowableValues="_ABC, _EFG, _XYZ_", defaultValue="-efg") @RequestPart(value="enum_form_string", required=false) String enumFormString,@ApiParam(value = "Header parameter enum test (string array)" , allowableValues="GREATER_THAN, DOLLAR") @RequestHeader(value="enum_header_string_array", required=false) List enumHeaderStringArray,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_ABC, _EFG, _XYZ_", defaultValue="-efg") @RequestHeader(value="enum_header_string", required=false) String enumHeaderString, @ApiParam(value = "Query parameter enum test (string array)", allowableValues = "GREATER_THAN, DOLLAR") @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray, @ApiParam(value = "Query parameter enum test (string)", allowableValues = "_ABC, _EFG, _XYZ_", defaultValue = "-efg") @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString, @ApiParam(value = "Query parameter enum test (double)") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger,@ApiParam(value = "Query parameter enum test (double)" ) @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble);
+ ResponseEntity testEnumParameters(@ApiParam(value = "Form parameter enum test (string array)" , allowableValues="GREATER_THAN, DOLLAR") @RequestPart(value="enum_form_string_array", required=false) List enumFormStringArray,@ApiParam(value = "Form parameter enum test (string)" , allowableValues="_ABC, _EFG, _XYZ_", defaultValue="-efg") @RequestPart(value="enum_form_string", required=false) String enumFormString,@ApiParam(value = "Header parameter enum test (string array)" , allowableValues="GREATER_THAN, DOLLAR") @RequestHeader(value="enum_header_string_array", required=false) List enumHeaderStringArray,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_ABC, _EFG, _XYZ_", defaultValue="-efg") @RequestHeader(value="enum_header_string", required=false) String enumHeaderString, @ApiParam(value = "Query parameter enum test (string array)", allowableValues = "GREATER_THAN, DOLLAR") @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray, @ApiParam(value = "Query parameter enum test (string)", allowableValues = "_ABC, _EFG, _XYZ_", defaultValue = "-efg") @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString, @ApiParam(value = "Query parameter enum test (double)", allowableValues = "NUMBER_1, NUMBER_MINUS_2") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger,@ApiParam(value = "Query parameter enum test (double)" , allowableValues="NUMBER_1_DOT_1, NUMBER_MINUS_1_DOT_2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble);
}
diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/FakeApiController.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/FakeApiController.java
index 21f28bc17f1..b2a589a0320 100644
--- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/FakeApiController.java
+++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/FakeApiController.java
@@ -60,8 +60,8 @@ public ResponseEntity testEnumParameters(@ApiParam(value = "Form parameter
@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_ABC, _EFG, _XYZ_", defaultValue="-efg") @RequestHeader(value="enum_header_string", required=false) String enumHeaderString,
@ApiParam(value = "Query parameter enum test (string array)", allowableValues = "GREATER_THAN, DOLLAR") @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray,
@ApiParam(value = "Query parameter enum test (string)", allowableValues = "_ABC, _EFG, _XYZ_", defaultValue = "-efg") @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString,
- @ApiParam(value = "Query parameter enum test (double)") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger,
- @ApiParam(value = "Query parameter enum test (double)" ) @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble) {
+ @ApiParam(value = "Query parameter enum test (double)", allowableValues = "NUMBER_1, NUMBER_MINUS_2") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger,
+ @ApiParam(value = "Query parameter enum test (double)" , allowableValues="NUMBER_1_DOT_1, NUMBER_MINUS_1_DOT_2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble) {
// do some magic!
return delegate.testEnumParameters(enumFormStringArray, enumFormString, enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble);
}
diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/FakeApi.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/FakeApi.java
index ae092a55402..7179c47133f 100644
--- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/FakeApi.java
+++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/FakeApi.java
@@ -56,6 +56,6 @@ public interface FakeApi {
produces = { "*/*" },
consumes = { "*/*" },
method = RequestMethod.GET)
- ResponseEntity testEnumParameters(@ApiParam(value = "Form parameter enum test (string array)" , allowableValues="GREATER_THAN, DOLLAR") @RequestPart(value="enum_form_string_array", required=false) List enumFormStringArray,@ApiParam(value = "Form parameter enum test (string)" , allowableValues="_ABC, _EFG, _XYZ_", defaultValue="-efg") @RequestPart(value="enum_form_string", required=false) String enumFormString,@ApiParam(value = "Header parameter enum test (string array)" , allowableValues="GREATER_THAN, DOLLAR") @RequestHeader(value="enum_header_string_array", required=false) List enumHeaderStringArray,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_ABC, _EFG, _XYZ_", defaultValue="-efg") @RequestHeader(value="enum_header_string", required=false) String enumHeaderString, @ApiParam(value = "Query parameter enum test (string array)", allowableValues = "GREATER_THAN, DOLLAR") @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray, @ApiParam(value = "Query parameter enum test (string)", allowableValues = "_ABC, _EFG, _XYZ_", defaultValue = "-efg") @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString, @ApiParam(value = "Query parameter enum test (double)") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger,@ApiParam(value = "Query parameter enum test (double)" ) @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble);
+ ResponseEntity testEnumParameters(@ApiParam(value = "Form parameter enum test (string array)" , allowableValues="GREATER_THAN, DOLLAR") @RequestPart(value="enum_form_string_array", required=false) List enumFormStringArray,@ApiParam(value = "Form parameter enum test (string)" , allowableValues="_ABC, _EFG, _XYZ_", defaultValue="-efg") @RequestPart(value="enum_form_string", required=false) String enumFormString,@ApiParam(value = "Header parameter enum test (string array)" , allowableValues="GREATER_THAN, DOLLAR") @RequestHeader(value="enum_header_string_array", required=false) List enumHeaderStringArray,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_ABC, _EFG, _XYZ_", defaultValue="-efg") @RequestHeader(value="enum_header_string", required=false) String enumHeaderString, @ApiParam(value = "Query parameter enum test (string array)", allowableValues = "GREATER_THAN, DOLLAR") @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray, @ApiParam(value = "Query parameter enum test (string)", allowableValues = "_ABC, _EFG, _XYZ_", defaultValue = "-efg") @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString, @ApiParam(value = "Query parameter enum test (double)", allowableValues = "NUMBER_1, NUMBER_MINUS_2") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger,@ApiParam(value = "Query parameter enum test (double)" , allowableValues="NUMBER_1_DOT_1, NUMBER_MINUS_1_DOT_2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble);
}
diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/FakeApiController.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/FakeApiController.java
index 9011ce8ef63..9e866bea99c 100644
--- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/FakeApiController.java
+++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/FakeApiController.java
@@ -55,8 +55,8 @@ public ResponseEntity testEnumParameters(@ApiParam(value = "Form parameter
@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_ABC, _EFG, _XYZ_", defaultValue="-efg") @RequestHeader(value="enum_header_string", required=false) String enumHeaderString,
@ApiParam(value = "Query parameter enum test (string array)", allowableValues = "GREATER_THAN, DOLLAR") @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray,
@ApiParam(value = "Query parameter enum test (string)", allowableValues = "_ABC, _EFG, _XYZ_", defaultValue = "-efg") @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString,
- @ApiParam(value = "Query parameter enum test (double)") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger,
- @ApiParam(value = "Query parameter enum test (double)" ) @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble) {
+ @ApiParam(value = "Query parameter enum test (double)", allowableValues = "NUMBER_1, NUMBER_MINUS_2") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger,
+ @ApiParam(value = "Query parameter enum test (double)" , allowableValues="NUMBER_1_DOT_1, NUMBER_MINUS_1_DOT_2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble) {
// do some magic!
return new ResponseEntity(HttpStatus.OK);
}