diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index a40a96f7b38..d7d241c1040 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -28,15 +28,19 @@ For a list of variables available in the template, please refer to this [page](h
### Style guide
Code change should conform to the programming style guide of the respective langauages:
+- Android: https://source.android.com/source/code-style.html
- C#: https://msdn.microsoft.com/en-us/library/vstudio/ff926074.aspx
+- 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/tree/master/es5
+- Groovy: http://groovy-lang.org/style-guide.html
- Go: https://github.com/golang/go/wiki/CodeReviewComments
- ObjC: https://github.com/NYTimes/objective-c-style-guide
- Perl: http://perldoc.perl.org/perlstyle.html
- PHP: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md
- Python: https://www.python.org/dev/peps/pep-0008/
- Ruby: https://github.com/bbatsov/ruby-style-guide
+- Scala: http://docs.scala-lang.org/style/
- Swift: https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/Swift_Programming_Language/TheBasics.html
- TypeScript: https://github.com/Microsoft/TypeScript/wiki/Coding-guidelines
diff --git a/README.md b/README.md
index ece108666e1..fb1d8501287 100644
--- a/README.md
+++ b/README.md
@@ -641,155 +641,7 @@ open index.html
### To build a server stub
-You can also use the codegen to generate a server for a couple different frameworks. Take a look here:
-
-### Node.js
-
-```
-java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate \
- -i http://petstore.swagger.io/v2/swagger.json \
- -l nodejs-server \
- -o samples/server/petstore/nodejs
-```
-
-### PHP Slim
-
-```
-java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate \
- -i http://petstore.swagger.io/v2/swagger.json \
- -l slim \
- -o samples/server/petstore/slim
-```
-
-### PHP Silex
-
-```
-java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate \
- -i http://petstore.swagger.io/v2/swagger.json \
- -l silex-PHP \
- -o samples/server/petstore/silex
-```
-
-### Python Flask (Connexion)
-
-```
-java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate \
- -i http://petstore.swagger.io/v2/swagger.json \
- -l python-flask \
- -o samples/server/petstore/flaskConnexion
-```
-
-### Ruby Sinatra
-
-```
-java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate \
- -i http://petstore.swagger.io/v2/swagger.json \
- -l sinatra \
- -o samples/server/petstore/sinatra
-```
-
-### Scala Scalatra
-```
-java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate \
- -i http://petstore.swagger.io/v2/swagger.json \
- -l scalatra \
- -o samples/server/petstore/scalatra
-```
-
-### Java JAX-RS (Jersey v1.18)
-
-```
-java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate \
- -i http://petstore.swagger.io/v2/swagger.json \
- -l jaxrs \
- -o samples/server/petstore/jaxrs-jersey
-```
-
-### Java JAX-RS (Apache CXF 2 / 3)
-
-```
-java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate \
- -i http://petstore.swagger.io/v2/swagger.json \
- -l jaxrs-cxf \
- -o samples/server/petstore/jaxrs-cxf
-```
-
-This Codegen only generate a minimalist server stub. You must add the CXF dependency to your classpath (eg: with Maven)
-If you are using CXF v2.x, you must provided a custom ```ResourceComparator``` class. This class will help CXF to choose the good resource interface for mapping an incomming request. The default behavior of CXF v2.x is not correct when many resources interface have the same global path.
-See: See http://cxf.apache.org/docs/jax-rs-basics.html#JAX-RSBasics-Customselectionbetweenmultipleresources
-
-You can found this class here: https://github.com/hiveship/CXF2-resource-comparator/blob/master/src/main/java/CXFInterfaceComparator.java
-TODO: This class could be directly generated by the Codegen.
-
-You must register this class into your JAX-RS configuration file:
-```xml
-
-
-
-```
-
-This is no longer necessary if you are using CXF >=v3.x
-
-### Java JAX-RS (Resteasy)
-
-```
-java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate \
- -i http://petstore.swagger.io/v2/swagger.json \
- -l jaxrs-resteasy \
- -o samples/server/petstore/jaxrs-resteasy
-```
-
-### Java Spring MVC
-
-```
-java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate \
- -i http://petstore.swagger.io/v2/swagger.json \
- -l spring-mvc \
- -o samples/server/petstore/spring-mvc
-```
-
-### Java SpringBoot
-
-```
-java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate \
- -i http://petstore.swagger.io/v2/swagger.json \
- -l springboot \
- -o samples/server/petstore/springboot
-```
-
-You can also set a Json file with basePackage & configPackage properties :
-Example :
-```
-{
-"basePackage":"io.swagger",
-"configPackage":"io.swagger.config"
-}
-```
-For use it add option ```-c myOptions.json``` to the generation command
-
-To Use-it :
-in the generated folder try ``` mvn package ``` for build jar.
-Start your server ``` java -jar target/swagger-springboot-server-1.0.0.jar ```
-SpringBoot listening on default port 8080
-
-
-### Haskell Servant
-
-```
-java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate \
- -i http://petstore.swagger.io/v2/swagger.json \
- -l haskell-servant \
- -o samples/server/petstore/haskell-servant
-```
-
-### ASP.NET 5 Web API
-
-```
-java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate \
- -i http://petstore.swagger.io/v2/swagger.json \
- -l aspnet5 \
- -o samples/server/petstore/aspnet5
-```
+Please refer to https://github.com/swagger-api/swagger-codegen/wiki/Server-stub-generator-HOWTO for more information.
### To build the codegen library
@@ -864,6 +716,7 @@ Here are some companies/projects using Swagger Codegen in production. To add you
- [IMS Health](http://www.imshealth.com/en/solution-areas/technology-and-applications)
- [Interactive Intelligence](http://developer.mypurecloud.com/)
- [LANDR Audio](https://www.landr.com/)
+- [Lascaux](http://www.lascaux.it/)
- [LiveAgent](https://www.ladesk.com/)
- [Kabuku](http://www.kabuku.co.jp/en)
- [Kuary](https://kuary.com/)
@@ -935,6 +788,7 @@ Swaagger Codegen core team members are contributors who have been making signfic
Here is a list of template creators:
* API Clients:
* Akka-Scala: @cchafer
+ * C++ REST: @Danielku15
* C# (.NET 2.0): @who
* Clojure: @xhh
* Dart: @yissachar
diff --git a/bin/cpprest-petstore.sh b/bin/cpprest-petstore.sh
new file mode 100755
index 00000000000..93f7ad609cc
--- /dev/null
+++ b/bin/cpprest-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 -t modules/swagger-codegen/src/main/resources/cpprest -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l cpprest -o samples/client/petstore/cpprest"
+
+java $JAVA_OPTS -jar $executable $ags
diff --git a/bin/go-petstore-server.sh b/bin/go-petstore-server.sh
new file mode 100755
index 00000000000..a668a1cfbdd
--- /dev/null
+++ b/bin/go-petstore-server.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 -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l go-server -o samples/server/petstore/go-api-server -DpackageName=petstoreserver "
+
+java $JAVA_OPTS -Dservice -jar $executable $ags
diff --git a/bin/lumen-petstore-server.sh b/bin/lumen-petstore-server.sh
index 15acb2fe2bd..a4a5df0f817 100755
--- a/bin/lumen-petstore-server.sh
+++ b/bin/lumen-petstore-server.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/lumen -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l lumen -o samples/server/petstore/lumen"
+ags="$@ generate -t modules/swagger-codegen/src/main/resources/lumen -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l lumen -o samples/server/petstore/lumen"
java $JAVA_OPTS -jar $executable $ags
diff --git a/bin/swift-petstore-all.sh b/bin/swift-petstore-all.sh
new file mode 100755
index 00000000000..e74eba37704
--- /dev/null
+++ b/bin/swift-petstore-all.sh
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+SCRIPT="$0"
+
+while [ -h "$SCRIPT" ] ; do
+ ls=`ls -ld "$SCRIPT"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ SCRIPT="$link"
+ else
+ SCRIPT=`dirname "$SCRIPT"`/"$link"
+ fi
+done
+
+if [ ! -d "${APP_DIR}" ]; then
+ APP_DIR=`dirname "$SCRIPT"`/..
+ APP_DIR=`cd "${APP_DIR}"; pwd`
+fi
+
+executable="./modules/swagger-codegen-cli/target/swagger-codegen-cli.jar"
+
+if [ ! -f "$executable" ]
+then
+ mvn clean package
+fi
+
+# if you've executed sbt assembly previously it will use that instead.
+export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
+ags="$@ generate -t modules/swagger-codegen/src/main/resources/swift -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l swift -c ./bin/swift-petstore.json -o samples/client/petstore/swift/default"
+
+echo "#### Petstore Swift API client (default) ####"
+java $JAVA_OPTS -jar $executable $ags
+
+ags="$@ generate -t modules/swagger-codegen/src/main/resources/swift -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l swift -c ./bin/swift-petstore-promisekit.json -o samples/client/petstore/swift/promisekit"
+echo "#### Petstore Swift API client (promisekit) ####"
+java $JAVA_OPTS -jar $executable $ags
diff --git a/bin/windows/cpprest-petstore.bat b/bin/windows/cpprest-petstore.bat
new file mode 100755
index 00000000000..43312669840
--- /dev/null
+++ b/bin/windows/cpprest-petstore.bat
@@ -0,0 +1,10 @@
+set executable=.\modules\swagger-codegen-cli\target\swagger-codegen-cli.jar
+
+If Not Exist %executable% (
+ mvn clean package
+)
+
+set JAVA_OPTS=%JAVA_OPTS% -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties
+set ags=generate -t modules\swagger-codegen\src\main\resources\cpprest -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l cpprest -o samples\client\petstore\cpprest
+
+java %JAVA_OPTS% -jar %executable% %ags%
diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenModel.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenModel.java
index c11f444437b..3752f69dca5 100644
--- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenModel.java
+++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenModel.java
@@ -22,6 +22,7 @@ public class CodegenModel {
public String unescapedDescription;
public String discriminator;
public String defaultValue;
+ public String arrayModelType;
public List vars = new ArrayList();
public List requiredVars = new ArrayList(); // a list of required properties
public List optionalVars = new ArrayList(); // a list of optional properties
@@ -35,7 +36,7 @@ public class CodegenModel {
public Set allMandatory;
public Set imports = new TreeSet();
- public Boolean hasVars, emptyVars, hasMoreModels, hasEnums, isEnum, hasRequired;
+ public Boolean hasVars, emptyVars, hasMoreModels, hasEnums, isEnum, hasRequired, isArrayModel;
public ExternalDocs externalDocs;
public Map vendorExtensions;
diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java
index 8304849a14c..0bd0c08cccc 100644
--- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java
+++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java
@@ -1198,6 +1198,8 @@ public class DefaultCodegen {
ArrayModel am = (ArrayModel) model;
ArrayProperty arrayProperty = new ArrayProperty(am.getItems());
m.hasEnums = false; // Otherwise there will be a NullPointerException in JavaClientCodegen.fromModel
+ m.isArrayModel = true;
+ m.arrayModelType = fromProperty(name, arrayProperty).complexType;
addParentContainer(m, name, arrayProperty);
} else if (model instanceof RefModel) {
// TODO
@@ -1465,7 +1467,9 @@ public class DefaultCodegen {
if (p instanceof BinaryProperty) {
property.isBinary = true;
}
-
+ if (p instanceof UUIDProperty) {
+ property.isString = true;
+ }
if (p instanceof ByteArrayProperty) {
property.isByteArray = true;
}
diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/CppRestClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/CppRestClientCodegen.java
new file mode 100644
index 00000000000..f8299fc60cd
--- /dev/null
+++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/CppRestClientCodegen.java
@@ -0,0 +1,380 @@
+package io.swagger.codegen.languages;
+
+import io.swagger.codegen.*;
+import io.swagger.codegen.examples.ExampleGenerator;
+import io.swagger.models.Model;
+import io.swagger.models.Operation;
+import io.swagger.models.Response;
+import io.swagger.models.Swagger;
+import io.swagger.models.properties.*;
+
+import java.util.*;
+import java.io.File;
+
+public class CppRestClientCodegen extends DefaultCodegen implements CodegenConfig {
+
+ public static final String DECLSPEC = "declspec";
+ public static final String DEFAULT_INCLUDE = "defaultInclude";
+
+ protected String packageVersion = "1.0.0";
+ protected String declspec = "";
+ protected String defaultInclude = "";
+
+ /**
+ * Configures the type of generator.
+ *
+ * @return the CodegenType for this generator
+ * @see io.swagger.codegen.CodegenType
+ */
+ public CodegenType getTag() {
+ return CodegenType.CLIENT;
+ }
+
+ /**
+ * Configures a friendly name for the generator. This will be used by the
+ * generator to select the library with the -l flag.
+ *
+ * @return the friendly name for the generator
+ */
+ public String getName() {
+ return "cpprest";
+ }
+
+ /**
+ * Returns human-friendly help for the generator. Provide the consumer with
+ * help tips, parameters here
+ *
+ * @return A string value for the help message
+ */
+ public String getHelp() {
+ return "Generates a C++ API client with C++ REST SDK (https://github.com/Microsoft/cpprestsdk).";
+ }
+
+ public CppRestClientCodegen() {
+ super();
+
+ apiPackage = "io.swagger.client.api";
+ modelPackage = "io.swagger.client.model";
+
+ modelTemplateFiles.put("model-header.mustache", ".h");
+ modelTemplateFiles.put("model-source.mustache", ".cpp");
+
+ apiTemplateFiles.put("api-header.mustache", ".h");
+ apiTemplateFiles.put("api-source.mustache", ".cpp");
+
+ templateDir = "cpprest";
+
+ cliOptions.clear();
+
+ // CLI options
+ addOption(CodegenConstants.MODEL_PACKAGE, "C++ namespace for models (convention: name.space.model).",
+ this.modelPackage);
+ addOption(CodegenConstants.API_PACKAGE, "C++ namespace for apis (convention: name.space.api).",
+ this.apiPackage);
+ addOption(CodegenConstants.PACKAGE_VERSION, "C++ package version.", this.packageVersion);
+ addOption(DECLSPEC, "C++ preprocessor to place before the class name for handling dllexport/dllimport.",
+ this.declspec);
+ addOption(DEFAULT_INCLUDE,
+ "The default include statement that should be placed in all headers for including things like the declspec (convention: #include \"Commons.h\" ",
+ this.defaultInclude);
+
+ reservedWords = new HashSet();
+
+ supportingFiles.add(new SupportingFile("modelbase-header.mustache", "", "ModelBase.h"));
+ supportingFiles.add(new SupportingFile("modelbase-source.mustache", "", "ModelBase.cpp"));
+ supportingFiles.add(new SupportingFile("apiclient-header.mustache", "", "ApiClient.h"));
+ supportingFiles.add(new SupportingFile("apiclient-source.mustache", "", "ApiClient.cpp"));
+ supportingFiles.add(new SupportingFile("apiconfiguration-header.mustache", "", "ApiConfiguration.h"));
+ supportingFiles.add(new SupportingFile("apiconfiguration-source.mustache", "", "ApiConfiguration.cpp"));
+ supportingFiles.add(new SupportingFile("apiexception-header.mustache", "", "ApiException.h"));
+ supportingFiles.add(new SupportingFile("apiexception-source.mustache", "", "ApiException.cpp"));
+ supportingFiles.add(new SupportingFile("ihttpbody-header.mustache", "", "IHttpBody.h"));
+ supportingFiles.add(new SupportingFile("jsonbody-header.mustache", "", "JsonBody.h"));
+ supportingFiles.add(new SupportingFile("jsonbody-source.mustache", "", "JsonBody.cpp"));
+ supportingFiles.add(new SupportingFile("httpcontent-header.mustache", "", "HttpContent.h"));
+ supportingFiles.add(new SupportingFile("httpcontent-source.mustache", "", "HttpContent.cpp"));
+ supportingFiles.add(new SupportingFile("multipart-header.mustache", "", "MultipartFormData.h"));
+ supportingFiles.add(new SupportingFile("multipart-source.mustache", "", "MultipartFormData.cpp"));
+ supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore"));
+ supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh"));
+
+ languageSpecificPrimitives = new HashSet(
+ Arrays.asList("int", "char", "bool", "long", "float", "double", "int32_t", "int64_t"));
+
+ typeMapping = new HashMap();
+ typeMapping.put("date", "utility::datetime");
+ typeMapping.put("DateTime", "utility::datetime");
+ typeMapping.put("string", "utility::string_t");
+ typeMapping.put("integer", "int32_t");
+ typeMapping.put("long", "int64_t");
+ typeMapping.put("boolean", "bool");
+ typeMapping.put("array", "std::vector");
+ typeMapping.put("map", "std::map");
+ typeMapping.put("file", "HttpContent");
+ typeMapping.put("object", "Object");
+ typeMapping.put("binary", "std::string");
+
+ super.importMapping = new HashMap();
+ importMapping.put("std::vector", "#include ");
+ importMapping.put("std::map", "#include