Merge remote-tracking branch 'origin/master' into 230_merge_master

This commit is contained in:
wing328 2017-06-05 23:27:11 +08:00
commit 87bbbc1a1b
1289 changed files with 22425 additions and 48047 deletions

16
.gitignore vendored
View File

@ -102,11 +102,19 @@ samples/client/petstore/objc/core-data/SwaggerClientTests/SwaggerClient.xcworksp
samples/client/petstore/objc/core-data/SwaggerClientTests/Podfile.lock
# Swift
samples/client/petstore/swift/SwaggerClientTests/SwaggerClient.xcodeproj/xcuserdata
samples/client/petstore/swift/SwaggerClientTests/SwaggerClient.xcworkspace/xcuserdata
samples/client/petstore/swift/SwaggerClientTests/Pods/Pods.xcodeproj/xcuserdata
samples/client/petstore/swift/SwaggerClientTests/Pods/Pods.xcodeproj/xcshareddata/xcschemes
samples/client/petstore/swift/**/SwaggerClientTests/SwaggerClient.xcodeproj/xcuserdata
samples/client/petstore/swift/**/SwaggerClientTests/SwaggerClient.xcworkspace/xcuserdata
samples/client/petstore/swift/**/SwaggerClientTests/Pods/
#samples/client/petstore/swift/**/SwaggerClientTests/Pods/Pods.xcodeproj/xcuserdata
#samples/client/petstore/swift/**/SwaggerClientTests/Pods/Pods.xcodeproj/xcshareddata/xcschemes
samples/client/petstore/swift/**/SwaggerClientTests/Podfile.lock
# Swift3
samples/client/petstore/swift3/**/SwaggerClientTests/SwaggerClient.xcodeproj/xcuserdata
samples/client/petstore/swift3/**/SwaggerClientTests/SwaggerClient.xcworkspace/xcuserdata
#samples/client/petstore/swift3/**/SwaggerClientTests/Pods/
#samples/client/petstore/swift3/**/SwaggerClientTests/Pods/Pods.xcodeproj/xcuserdata
#samples/client/petstore/swift3/**/SwaggerClientTests/Pods/Pods.xcodeproj/xcshareddata/xcschemes
samples/client/petstore/swift3/**/SwaggerClientTests/Podfile.lock
# C#
*.csproj.user

View File

@ -1,9 +1,6 @@
sudo: required
language: java
jdk:
- oraclejdk7
- oraclejdk8
language: objective-c
osx_image: xcode8.2
cache:
directories:
- $HOME/.m2
@ -25,39 +22,60 @@ cache:
- $HOME/samples/client/petstore/typescript-fetch/npm/with-npm-version/typings
- $HOME/samples/client/petstore/typescript-angular/node_modules
- $HOME/samples/client/petstore/typescript-angular/typings
- $HOME/.cocoapods/repos/master
# note: docker is not yet supported in iOS build
#services:
# - docker
services:
- docker
# comment out the host table change to use the public petstore server
addons:
hosts:
- petstore.swagger.io
before_install:
# required when sudo: required for the Ruby petstore tests
- gem install bundler
- export SW=`pwd`
- rvm list
- rvm use 2.2.5
- gem environment
- gem install bundler -N --no-ri --no-rdoc
- gem install cocoapods -v 1.2.1 -N --no-ri --no-rdoc
- gem install xcpretty -N --no-ri --no-rdoc
- pod --version
# comment out below to avoid errors
#- pod repo update
- pod setup --silent > /dev/null
- npm install -g typescript
- npm config set registry http://registry.npmjs.org/
- sudo pip install virtualenv
- brew install sbt
- brew install leiningen
- brew install bats
- brew install curl
- brew install python3
- pip install virtualenv
# start local petstore server
- git clone -b docker --single-branch https://github.com/wing328/swagger-samples
- cd swagger-samples/java/java-jersey-jaxrs
- sudo mvn jetty:run &
- cd $SW
# NOTE: iOS build not support docker at the moment
# to run petstore server locally via docker
- docker pull swaggerapi/petstore
- docker run -d -e SWAGGER_HOST=http://petstore.swagger.io -e SWAGGER_BASE_PATH=/v2 -p 80:8080 swaggerapi/petstore
- docker ps -a
# Add bats test framework and cURL for Bash script integration tests
- sudo add-apt-repository ppa:duggan/bats --yes
- sudo apt-get update -qq
- sudo apt-get install -qq bats
- sudo apt-get install -qq curl
#- docker pull swaggerapi/petstore
#- docker run -d -e SWAGGER_HOST=http://petstore.swagger.io -e SWAGGER_BASE_PATH=/v2 -p 80:8080 swaggerapi/petstore
#- docker ps -a
# Add rebar3 build tool and recent Erlang/OTP for Erlang petstore server tests.
# - Travis CI does not support rebar3 [yet](https://github.com/travis-ci/travis-ci/issues/6506#issuecomment-275189490).
# - Rely on `kerl` for [pre-compiled versions available](https://docs.travis-ci.com/user/languages/erlang#Choosing-OTP-releases-to-test-against). Rely on installation path chosen by [`travis-erlang-builder`](https://github.com/travis-ci/travis-erlang-builder/blob/e6d016b1a91ca7ecac5a5a46395bde917ea13d36/bin/compile#L18).
- . ~/otp/18.2.1/activate && erl -version
- curl -f -L -o ./rebar3 https://s3.amazonaws.com/rebar3/rebar3 && chmod +x ./rebar3 && ./rebar3 version && export PATH="${TRAVIS_BUILD_DIR}:$PATH"
# show host table to confirm petstore.swagger.io is mapped to localhost
- cat /etc/hosts
# show java version
- java -version
# show brew version
- brew --version
# show xcpretty version
- xcpretty -v
# show go version
- go version
install:
# Add Godeps dependencies to GOPATH and PATH
@ -75,9 +93,9 @@ script:
# run integration tests defined in maven pom.xml
- mvn -q --batch-mode verify -Psamples
# docker: build generator image and push to Docker Hub
- if [ $DOCKER_HUB_USERNAME ]; then docker login --email=$DOCKER_HUB_EMAIL --username=$DOCKER_HUB_USERNAME --password=$DOCKER_HUB_PASSWORD && docker build -t $DOCKER_GENERATOR_IMAGE_NAME ./modules/swagger-generator && if [ ! -z "$TRAVIS_TAG" ]; then docker tag $DOCKER_GENERATOR_IMAGE_NAME:latest $DOCKER_GENERATOR_IMAGE_NAME:$TRAVIS_TAG; fi && if [ ! -z "$TRAVIS_TAG" ] || [ "$TRAVIS_BRANCH" = "master" ]; then docker push $DOCKER_GENERATOR_IMAGE_NAME; fi; fi
# docker: build cli image and push to Docker Hub
- if [ $DOCKER_HUB_USERNAME ]; then docker login --email=$DOCKER_HUB_EMAIL --username=$DOCKER_HUB_USERNAME --password=$DOCKER_HUB_PASSWORD && docker build -t $DOCKER_CODEGEN_CLI_IMAGE_NAME ./modules/swagger-codegen-cli && if [ ! -z "$TRAVIS_TAG" ]; then docker tag $DOCKER_CODEGEN_CLI_IMAGE_NAME:latest $DOCKER_CODEGEN_CLI_IMAGE_NAME:$TRAVIS_TAG; fi && if [ ! -z "$TRAVIS_TAG" ] || [ "$TRAVIS_BRANCH" = "master" ]; then docker push $DOCKER_CODEGEN_CLI_IMAGE_NAME; fi; fi
#- if [ $DOCKER_HUB_USERNAME ]; then docker login --email=$DOCKER_HUB_EMAIL --username=$DOCKER_HUB_USERNAME --password=$DOCKER_HUB_PASSWORD && docker build -t $DOCKER_GENERATOR_IMAGE_NAME ./modules/swagger-generator && if [ ! -z "$TRAVIS_TAG" ]; then docker tag $DOCKER_GENERATOR_IMAGE_NAME:latest $DOCKER_GENERATOR_IMAGE_NAME:$TRAVIS_TAG; fi && if [ ! -z "$TRAVIS_TAG" ] || [ "$TRAVIS_BRANCH" = "master" ]; then docker push $DOCKER_GENERATOR_IMAGE_NAME; fi; fi
## docker: build cli image and push to Docker Hub
#- if [ $DOCKER_HUB_USERNAME ]; then docker login --email=$DOCKER_HUB_EMAIL --username=$DOCKER_HUB_USERNAME --password=$DOCKER_HUB_PASSWORD && docker build -t $DOCKER_CODEGEN_CLI_IMAGE_NAME ./modules/swagger-codegen-cli && if [ ! -z "$TRAVIS_TAG" ]; then docker tag $DOCKER_CODEGEN_CLI_IMAGE_NAME:latest $DOCKER_CODEGEN_CLI_IMAGE_NAME:$TRAVIS_TAG; fi && if [ ! -z "$TRAVIS_TAG" ] || [ "$TRAVIS_BRANCH" = "master" ]; then docker push $DOCKER_CODEGEN_CLI_IMAGE_NAME; fi; fi
env:
- DOCKER_GENERATOR_IMAGE_NAME=swaggerapi/swagger-generator DOCKER_CODEGEN_CLI_IMAGE_NAME=swaggerapi/swagger-codegen-cli

View File

@ -25,7 +25,7 @@
This is the swagger codegen project, which allows generation of API client libraries (SDK generation), server stubs and documentation automatically given an [OpenAPI Spec](https://github.com/OAI/OpenAPI-Specification). Currently, the following languages/frameworks are supported:
- **API clients**: **ActionScript**, **Apex**, **Bash**, **C#** (.net 2.0, 4.0 or later), **C++** (cpprest, Qt5, Tizen), **Clojure**, **Dart**, **Elixir**, **Go**, **Groovy**, **Haskell**, **Java** (Jersey1.x, Jersey2.x, OkHttp, Retrofit1.x, Retrofit2.x, Feign), **Kotlin**, **Node.js** (ES5, ES6, AngularJS with Google Closure Compiler annotations) **Objective-C**, **Perl**, **PHP**, **Python**, **Ruby**, **Scala**, **Swift** (2.x, 3.x), **Typescript** (Angular1.x, Angular2.x, Fetch, jQuery, Node)
- **Server stubs**: **C#** (ASP.NET Core, NancyFx), **Erlang**, **Go**, **Haskell**, **Java** (MSF4J, Spring, Undertow, JAX-RS: CDI, CXF, Inflector, RestEasy), **PHP** (Lumen, Slim, Silex, [Zend Expressive](https://github.com/zendframework/zend-expressive)), **Python** (Flask), **NodeJS**, **Ruby** (Sinatra, Rails5), **Scala** ([Finch](https://github.com/finagle/finch), Scalatra)
- **Server stubs**: **C#** (ASP.NET Core, NancyFx), **C++** (Restbed), **Erlang**, **Go**, **Haskell**, **Java** (MSF4J, Spring, Undertow, JAX-RS: CDI, CXF, Inflector, RestEasy, Play Framework), **PHP** (Lumen, Slim, Silex, [Zend Expressive](https://github.com/zendframework/zend-expressive)), **Python** (Flask), **NodeJS**, **Ruby** (Sinatra, Rails5), **Scala** ([Finch](https://github.com/finagle/finch), Scalatra)
- **API documentation generators**: **HTML**, **Confluence Wiki**
- **Others**: **JMeter**
@ -717,6 +717,7 @@ Here are some companies/projects using Swagger Codegen in production. To add you
- [Balance Internet](https://www.balanceinternet.com.au/)
- [beemo](http://www.beemo.eu)
- [bitly](https://bitly.com)
- [BeezUP](http://www.beezup.com)
- [Box](https://box.com)
- [Bufferfly Network](https://www.butterflynetinc.com/)
- [Cachet Financial](http://www.cachetfinancial.com/)
@ -930,6 +931,7 @@ Here is a list of template creators:
* Server Stubs
* C# ASP.NET5: @jimschubert
* C# NancyFX: @mstefaniuk
* C++ Restbed: @stkrwork
* Erlang Server: @galaxie
* Go Server: @guohuang
* Haskell Servant: @algas

View File

@ -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/objc -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l objc -DapiDocs=false,modelDocs=false -o samples/client/petstore/objc/core-data --additional-properties coreData=true"
ags="$@ generate -t modules/swagger-codegen/src/main/resources/objc -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l objc -DapiDocs=false,modelDocs=false -o samples/client/petstore/objc/core-data --additional-properties coreData=true"
java -DappName=PetstoreClient $JAVA_OPTS -jar $executable $ags

View File

@ -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/objc -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l objc -o samples/client/petstore/objc/default"
ags="$@ generate -t modules/swagger-codegen/src/main/resources/objc -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l objc -o samples/client/petstore/objc/default"
java -DappName=PetstoreClient $JAVA_OPTS -jar $executable $ags

31
bin/restbed-petstore-server.sh Executable file
View File

@ -0,0 +1,31 @@
#!/usr/bin/env bash
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 -l restbed -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -o samples/server/petstore/restbed"
java $JAVA_OPTS -jar $executable $ags

View File

@ -0,0 +1,10 @@
set executable=.\modules\swagger-codegen-cli\target\swagger-codegen-cli.jar
If Not Exist %executable% (
mvn clean package
)
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties
set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.yaml -l restbed -o samples\server\petstore\restbed\
java %JAVA_OPTS% -jar %executable% %ags%

View File

@ -14,6 +14,10 @@ dependencies:
- "~/.sbt"
pre:
- sudo add-apt-repository ppa:duggan/bats --yes
- sudo apt-get update -qq
- sudo apt-get install -qq bats
- sudo apt-get install -qq curl
# to run petstore server locally via docker
- docker pull swaggerapi/petstore
- docker run -d -e SWAGGER_HOST=http://petstore.swagger.io -e SWAGGER_BASE_PATH=/v2 -p 80:8080 swaggerapi/petstore
@ -32,3 +36,7 @@ test:
- sudo update-java-alternatives -s java-1.7.0-openjdk-amd64
- java -version
- mvn -q clean verify -Psamples
# docker: build generator image and push to Docker Hub
- if [ $DOCKER_HUB_USERNAME ]; then docker login --email=$DOCKER_HUB_EMAIL --username=$DOCKER_HUB_USERNAME --password=$DOCKER_HUB_PASSWORD && docker build -t $DOCKER_GENERATOR_IMAGE_NAME ./modules/swagger-generator && if [ ! -z "$CIRCLE_TAG" ]; then docker tag $DOCKER_GENERATOR_IMAGE_NAME:latest $DOCKER_GENERATOR_IMAGE_NAME:$CIRCLE_TAG; fi && if [ ! -z "$CIRCLE_TAG" ] || [ "$CIRCLE_BRANCH" = "master" ]; then docker push $DOCKER_GENERATOR_IMAGE_NAME; fi; fi
# docker: build cli image and push to Docker Hub
- if [ $DOCKER_HUB_USERNAME ]; then docker login --email=$DOCKER_HUB_EMAIL --username=$DOCKER_HUB_USERNAME --password=$DOCKER_HUB_PASSWORD && docker build -t $DOCKER_CODEGEN_CLI_IMAGE_NAME ./modules/swagger-codegen-cli && if [ ! -z "$CIRCLE_TAG" ]; then docker tag $DOCKER_CODEGEN_CLI_IMAGE_NAME:latest $DOCKER_CODEGEN_CLI_IMAGE_NAME:$CIRCLE_TAG; fi && if [ ! -z "$CIRCLE_TAG" ] || [ "$CIRCLE_BRANCH" = "master" ]; then docker push $DOCKER_CODEGEN_CLI_IMAGE_NAME; fi; fi

View File

@ -348,6 +348,11 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
importMapping.put("JsonCreator", "com.fasterxml.jackson.annotation.JsonCreator");
importMapping.put("JsonValue", "com.fasterxml.jackson.annotation.JsonValue");
importMapping.put("SerializedName", "com.google.gson.annotations.SerializedName");
importMapping.put("TypeAdapter", "com.google.gson.TypeAdapter");
importMapping.put("JsonAdapter", "com.google.gson.annotations.JsonAdapter");
importMapping.put("JsonReader", "com.google.gson.stream.JsonReader");
importMapping.put("JsonWriter", "com.google.gson.stream.JsonWriter");
importMapping.put("IOException", "java.io.IOException");
importMapping.put("Objects", "java.util.Objects");
importMapping.put("StringUtil", invokerPackage + ".StringUtil");
// import JsonCreator if JsonProperty is imported
@ -871,11 +876,13 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
hasFormParameters = true;
}
}
String defaultContentType = hasFormParameters ? "application/x-www-form-urlencoded" : "application/json";
String contentType = operation.getConsumes() == null || operation.getConsumes().isEmpty()
? defaultContentType : operation.getConsumes().get(0);
//only add content-Type if its no a GET-Method
if(path.getGet() != null || ! operation.equals(path.getGet())){
String defaultContentType = hasFormParameters ? "application/x-www-form-urlencoded" : "application/json";
String contentType = operation.getConsumes() == null || operation.getConsumes().isEmpty() ? defaultContentType : operation.getConsumes().get(0);
operation.setVendorExtension("x-contentType", contentType);
}
String accepts = getAccept(operation);
operation.setVendorExtension("x-contentType", contentType);
operation.setVendorExtension("x-accepts", accepts);
}
}

View File

@ -313,6 +313,8 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
clientPackageDir, "ApiResponse.cs"));
supportingFiles.add(new SupportingFile("ExceptionFactory.mustache",
clientPackageDir, "ExceptionFactory.cs"));
supportingFiles.add(new SupportingFile("SwaggerDateConverter.mustache",
clientPackageDir, "SwaggerDateConverter.cs"));
if(Boolean.FALSE.equals(this.netStandard) && Boolean.FALSE.equals(this.netCoreProjectFileFlag)) {
supportingFiles.add(new SupportingFile("compile.mustache", "", "build.bat"));

View File

@ -369,6 +369,11 @@ public class JavaClientCodegen extends AbstractJavaCodegen
}
if(additionalProperties.containsKey("gson")) {
model.imports.add("SerializedName");
model.imports.add("TypeAdapter");
model.imports.add("JsonAdapter");
model.imports.add("JsonReader");
model.imports.add("JsonWriter");
model.imports.add("IOException");
}
} else { // enum class
//Needed imports for Jackson's JsonCreator

View File

@ -0,0 +1,421 @@
package io.swagger.codegen.languages;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import io.swagger.codegen.CliOption;
import io.swagger.codegen.CodegenConfig;
import io.swagger.codegen.CodegenConstants;
import io.swagger.codegen.CodegenModel;
import io.swagger.codegen.CodegenOperation;
import io.swagger.codegen.CodegenParameter;
import io.swagger.codegen.CodegenProperty;
import io.swagger.codegen.CodegenType;
import io.swagger.codegen.DefaultCodegen;
import io.swagger.codegen.SupportingFile;
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.ArrayProperty;
import io.swagger.models.properties.BaseIntegerProperty;
import io.swagger.models.properties.BooleanProperty;
import io.swagger.models.properties.DateProperty;
import io.swagger.models.properties.DateTimeProperty;
import io.swagger.models.properties.DecimalProperty;
import io.swagger.models.properties.DoubleProperty;
import io.swagger.models.properties.FileProperty;
import io.swagger.models.properties.FloatProperty;
import io.swagger.models.properties.IntegerProperty;
import io.swagger.models.properties.LongProperty;
import io.swagger.models.properties.MapProperty;
import io.swagger.models.properties.Property;
import io.swagger.models.properties.RefProperty;
import io.swagger.models.properties.StringProperty;
public class RestbedCodegen 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.SERVER;
}
/**
* 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 "restbed";
}
/**
* 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 Server with Restbed (https://github.com/Corvusoft/restbed).";
}
public RestbedCodegen() {
super();
apiPackage = "io.swagger.server.api";
modelPackage = "io.swagger.server.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");
embeddedTemplateDir = templateDir = "restbed";
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<String>();
supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore"));
supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh"));
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
languageSpecificPrimitives = new HashSet<String>(
Arrays.asList("int", "char", "bool", "long", "float", "double", "int32_t", "int64_t"));
typeMapping = new HashMap<String, String>();
typeMapping.put("date", "std::string");
typeMapping.put("DateTime", "std::string");
typeMapping.put("string", "std::string");
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", "std::string");
typeMapping.put("object", "Object");
typeMapping.put("binary", "restbed::Bytes");
typeMapping.put("number", "double");
typeMapping.put("UUID", "std::string");
super.importMapping = new HashMap<String, String>();
importMapping.put("std::vector", "#include <vector>");
importMapping.put("std::map", "#include <map>");
importMapping.put("std::string", "#include <string>");
importMapping.put("Object", "#include \"Object.h\"");
importMapping.put("restbed::Bytes", "#include <corvusoft/restbed/byte.hpp>");
}
protected void addOption(String key, String description, String defaultValue) {
CliOption option = new CliOption(key, description);
if (defaultValue != null)
option.defaultValue(defaultValue);
cliOptions.add(option);
}
@Override
public void processOpts() {
super.processOpts();
if (additionalProperties.containsKey(DECLSPEC)) {
declspec = additionalProperties.get(DECLSPEC).toString();
}
if (additionalProperties.containsKey(DEFAULT_INCLUDE)) {
defaultInclude = additionalProperties.get(DEFAULT_INCLUDE).toString();
}
additionalProperties.put("modelNamespaceDeclarations", modelPackage.split("\\."));
additionalProperties.put("modelNamespace", modelPackage.replaceAll("\\.", "::"));
additionalProperties.put("apiNamespaceDeclarations", apiPackage.split("\\."));
additionalProperties.put("apiNamespace", apiPackage.replaceAll("\\.", "::"));
additionalProperties.put("declspec", declspec);
additionalProperties.put("defaultInclude", defaultInclude);
}
/**
* Escapes a reserved word as defined in the `reservedWords` array. Handle
* escaping those terms here. This logic is only called if a variable
* matches the reseved words
*
* @return the escaped term
*/
@Override
public String escapeReservedWord(String name) {
return "_" + name; // add an underscore to the name
}
/**
* Location to write model files. You can use the modelPackage() as defined
* when the class is instantiated
*/
public String modelFileFolder() {
return outputFolder + "/model";
}
/**
* Location to write api files. You can use the apiPackage() as defined when
* the class is instantiated
*/
@Override
public String apiFileFolder() {
return outputFolder + "/api";
}
@Override
public String toModelImport(String name) {
if (importMapping.containsKey(name)) {
return importMapping.get(name);
} else {
return "#include \"" + name + ".h\"";
}
}
@Override
public CodegenModel fromModel(String name, Model model, Map<String, Model> allDefinitions) {
CodegenModel codegenModel = super.fromModel(name, model, allDefinitions);
Set<String> oldImports = codegenModel.imports;
codegenModel.imports = new HashSet<String>();
for (String imp : oldImports) {
String newImp = toModelImport(imp);
if (!newImp.isEmpty()) {
codegenModel.imports.add(newImp);
}
}
return codegenModel;
}
@Override
public String toModelFilename(String name) {
return initialCaps(name);
}
@Override
public String toApiFilename(String name) {
return initialCaps(name) + "Api";
}
@SuppressWarnings("unchecked")
@Override
public Map<String, Object> postProcessOperations(Map<String, Object> objs) {
Map<String, Object> operations = (Map<String, Object>) objs.get("operations");
List<CodegenOperation> operationList = (List<CodegenOperation>) operations.get("operation");
List<CodegenOperation> newOpList = new ArrayList<CodegenOperation>();
for (CodegenOperation op : operationList) {
String path = new String(op.path);
String[] items = path.split("/", -1);
List<String> splitPath = new ArrayList<String>();
op.path = "";
for (String item: items) {
if (item.matches("^\\{(.*)\\}$")) {
item = item.substring(0, item.length()-1);
item += ": .*}";
}
splitPath.add(item);
op.path += item + "/";
}
boolean foundInNewList = false;
for (CodegenOperation op1 : newOpList) {
if (!foundInNewList) {
if (op1.path.equals(op.path)) {
foundInNewList = true;
List<CodegenOperation> currentOtherMethodList = (List<CodegenOperation>) op1.vendorExtensions.get("x-codegen-otherMethods");
if (currentOtherMethodList == null) {
currentOtherMethodList = new ArrayList<CodegenOperation>();
}
op.operationIdCamelCase = op1.operationIdCamelCase;
currentOtherMethodList.add(op);
op1.vendorExtensions.put("x-codegen-otherMethods", currentOtherMethodList);
}
}
}
if (!foundInNewList) {
newOpList.add(op);
}
}
operations.put("operation", newOpList);
return objs;
}
/**
* Optional - type declaration. This is a String which is used by the
* templates to instantiate your types. There is typically special handling
* for different property types
*
* @return a string value used as the `dataType` field for model templates,
* `returnType` for api templates
*/
@Override
public String getTypeDeclaration(Property p) {
String swaggerType = getSwaggerType(p);
if (p instanceof ArrayProperty) {
ArrayProperty ap = (ArrayProperty) p;
Property inner = ap.getItems();
return getSwaggerType(p) + "<" + getTypeDeclaration(inner) + ">";
}
if (p instanceof MapProperty) {
MapProperty mp = (MapProperty) p;
Property inner = mp.getAdditionalProperties();
return getSwaggerType(p) + "<std::string, " + getTypeDeclaration(inner) + ">";
}
if (p instanceof StringProperty || p instanceof DateProperty
|| p instanceof DateTimeProperty || p instanceof FileProperty
|| languageSpecificPrimitives.contains(swaggerType)) {
return toModelName(swaggerType);
}
return "std::shared_ptr<" + swaggerType + ">";
}
@Override
public String toDefaultValue(Property p) {
if (p instanceof StringProperty) {
return "\"\"";
} else if (p instanceof BooleanProperty) {
return "false";
} else if (p instanceof DateProperty) {
return "\"\"";
} else if (p instanceof DateTimeProperty) {
return "\"\"";
} else if (p instanceof DoubleProperty) {
return "0.0";
} else if (p instanceof FloatProperty) {
return "0.0f";
} else if (p instanceof IntegerProperty || p instanceof BaseIntegerProperty) {
return "0";
} else if (p instanceof LongProperty) {
return "0L";
} else if (p instanceof DecimalProperty) {
return "0.0";
} else if (p instanceof MapProperty) {
MapProperty ap = (MapProperty) p;
String inner = getSwaggerType(ap.getAdditionalProperties());
return "std::map<std::string, " + inner + ">()";
} else if (p instanceof ArrayProperty) {
ArrayProperty ap = (ArrayProperty) p;
String inner = getSwaggerType(ap.getItems());
if (!languageSpecificPrimitives.contains(inner)) {
inner = "std::shared_ptr<" + inner + ">";
}
return "std::vector<" + inner + ">()";
} else if (p instanceof RefProperty) {
RefProperty rp = (RefProperty) p;
return "new " + toModelName(rp.getSimpleRef()) + "()";
}
return "nullptr";
}
@Override
public void postProcessParameter(CodegenParameter parameter) {
super.postProcessParameter(parameter);
boolean isPrimitiveType = parameter.isPrimitiveType == Boolean.TRUE;
boolean isListContainer = parameter.isListContainer == Boolean.TRUE;
boolean isString = parameter.isString == Boolean.TRUE;
if (!isPrimitiveType && !isListContainer && !isString && !parameter.dataType.startsWith("std::shared_ptr")) {
parameter.dataType = "std::shared_ptr<" + parameter.dataType + ">";
}
}
/**
* Optional - swagger type conversion. This is used to map swagger types in
* a `Property` into either language specific types via `typeMapping` or
* into complex models if there is not a mapping.
*
* @return a string value of the type or complex model for this property
* @see io.swagger.models.properties.Property
*/
@Override
public String getSwaggerType(Property p) {
String swaggerType = super.getSwaggerType(p);
String type = null;
if (typeMapping.containsKey(swaggerType)) {
type = typeMapping.get(swaggerType);
if (languageSpecificPrimitives.contains(type))
return toModelName(type);
} else
type = swaggerType;
return toModelName(type);
}
@Override
public String toModelName(String type) {
if (typeMapping.keySet().contains(type) || typeMapping.values().contains(type)
|| importMapping.values().contains(type) || defaultIncludes.contains(type)
|| languageSpecificPrimitives.contains(type)) {
return type;
} else {
return Character.toUpperCase(type.charAt(0)) + type.substring(1);
}
}
@Override
public String toVarName(String name) {
if (typeMapping.keySet().contains(name) || typeMapping.values().contains(name)
|| importMapping.values().contains(name) || defaultIncludes.contains(name)
|| languageSpecificPrimitives.contains(name)) {
return name;
}
if (name.length() > 1) {
return Character.toUpperCase(name.charAt(0)) + name.substring(1);
}
return name;
}
@Override
public String toApiName(String type) {
return Character.toUpperCase(type.charAt(0)) + type.substring(1) + "Api";
}
@Override
public String escapeQuotationMark(String input) {
// remove " to avoid code injection
return input.replace("\"", "");
}
@Override
public String escapeUnsafeCharacters(String input) {
return input.replace("*/", "*_/").replace("/*", "/_*");
}
}

View File

@ -2,22 +2,24 @@
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
{{/jackson}}
{{#gson}}
import java.io.IOException;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
{{/gson}}
/**
* {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}}
*/
{{#gson}}
@JsonAdapter({{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.Adapter.class)
{{/gson}}
public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} {
{{#gson}}
{{#allowableValues}}{{#enumVars}}
@SerializedName({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}})
{{{name}}}({{{value}}}){{^-last}},
{{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}}
{{/gson}}
{{^gson}}
{{#allowableValues}}{{#enumVars}}
{{{name}}}({{{value}}}){{^-last}},
{{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}}
{{/gson}}
private {{{dataType}}} value;
@ -25,20 +27,21 @@ public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum
this.value = value;
}
{{#jackson}}
@JsonValue
{{/jackson}}
public {{{dataType}}} getValue() {
return value;
}
@Override
{{#jackson}}
@JsonValue
{{/jackson}}
public String toString() {
return String.valueOf(value);
}
{{#jackson}}
{{#jackson}}
@JsonCreator
{{/jackson}}
public static {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} fromValue(String text) {
for ({{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} b : {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.values()) {
if (String.valueOf(b.value).equals(text)) {
@ -47,5 +50,19 @@ public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum
}
return null;
}
{{/jackson}}
{{#gson}}
public static class Adapter extends TypeAdapter<{{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}> {
@Override
public void write(final JsonWriter jsonWriter, final {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} enumeration) throws IOException {
jsonWriter.value(enumeration.getValue());
}
@Override
public {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} read(final JsonReader jsonReader) throws IOException {
{{{dataType}}} value = jsonReader.{{#isInteger}}nextInt(){{/isInteger}}{{^isInteger}}next{{{dataType}}}(){{/isInteger}};
return {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.fromValue(String.valueOf(value));
}
}
{{/gson}}
}

View File

@ -1,24 +1,16 @@
/**
* {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}}
*/
{{#gson}}
@JsonAdapter({{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}.Adapter.class)
{{/gson}}
public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} {
{{#gson}}
{{#allowableValues}}
{{#enumVars}}
@SerializedName({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}})
{{#allowableValues}}
{{#enumVars}}
{{{name}}}({{{value}}}){{^-last}},
{{/-last}}{{#-last}};{{/-last}}
{{/enumVars}}
{{/allowableValues}}
{{/gson}}
{{^gson}}
{{#allowableValues}}
{{#enumVars}}
{{{name}}}({{{value}}}){{^-last}},
{{/-last}}{{#-last}};{{/-last}}
{{/enumVars}}
{{/allowableValues}}
{{/gson}}
{{/enumVars}}
{{/allowableValues}}
private {{{datatype}}} value;
@ -26,20 +18,21 @@
this.value = value;
}
{{#jackson}}
@JsonValue
{{/jackson}}
public {{{datatype}}} getValue() {
return value;
}
@Override
{{#jackson}}
@JsonValue
{{/jackson}}
public String toString() {
return String.valueOf(value);
}
{{#jackson}}
{{#jackson}}
@JsonCreator
{{/jackson}}
public static {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} fromValue(String text) {
for ({{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} b : {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.values()) {
if (String.valueOf(b.value).equals(text)) {
@ -48,5 +41,19 @@
}
return null;
}
{{/jackson}}
{{#gson}}
public static class Adapter extends TypeAdapter<{{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}> {
@Override
public void write(final JsonWriter jsonWriter, final {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} enumeration) throws IOException {
jsonWriter.value(enumeration.getValue());
}
@Override
public {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} read(final JsonReader jsonReader) throws IOException {
{{{datatype}}} value = jsonReader.{{#isInteger}}nextInt(){{/isInteger}}{{^isInteger}}next{{{datatype}}}(){{/isInteger}};
return {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}.fromValue(String.valueOf(value));
}
}
{{/gson}}
}

View File

@ -443,6 +443,8 @@
if (returnType === 'Blob') {
request.responseType('blob');
} else if (returnType === 'String') {
request.responseType('string');
}
// Attach previously saved cookies, if enabled

View File

@ -44,6 +44,7 @@ io.swagger.codegen.languages.PhpClientCodegen
io.swagger.codegen.languages.PythonClientCodegen
io.swagger.codegen.languages.Qt5CPPGenerator
io.swagger.codegen.languages.Rails5ServerCodegen
io.swagger.codegen.languages.RestbedCodegen
io.swagger.codegen.languages.RubyClientCodegen
io.swagger.codegen.languages.ScalaClientCodegen
io.swagger.codegen.languages.ScalatraServerCodegen

View File

@ -110,7 +110,7 @@ void {{classname}}::fromJson(web::json::value& val)
{{/isDateTime}}{{^isDateTime}}{{#vendorExtensions.x-codegen-file}}{{setter}}(ModelBase::fileFromJson(val[U("{{baseName}}")]));
{{/vendorExtensions.x-codegen-file}}{{^vendorExtensions.x-codegen-file}}{{{datatype}}} new{{name}}({{{defaultValue}}});
new{{name}}->fromJson(val[U("{{baseName}}")]);
{{setter}}( newItem );
{{setter}}( new{{name}} );
{{/vendorExtensions.x-codegen-file}}{{/isDateTime}}{{/isString}}{{/required}}{{/isPrimitiveType}}{{/isListContainer}}{{/vars}}
}

View File

@ -0,0 +1,21 @@
{{>partial_header}}
using Newtonsoft.Json.Converters;
namespace {{packageName}}.Client
{
/// <summary>
/// Formatter for 'date' swagger formats ss defined by full-date - RFC3339
/// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types
/// </summary>
public class SwaggerDateConverter : IsoDateTimeConverter
{
/// <summary>
/// Initializes a new instance of the <see cref="SwaggerDateConverter" /> class.
/// </summary>
public SwaggerDateConverter()
{
// full-date = date-fullyear "-" date-month "-" date-mday
DateTimeFormat = "yyyy-MM-dd";
}
}
}

View File

@ -19,6 +19,7 @@ using System.ComponentModel;
{{/generatePropertyChanged}}
using System.ComponentModel.DataAnnotations;
{{/netStandard}}
using SwaggerDateConverter = {{packageName}}.Client.SwaggerDateConverter;
{{#models}}
{{#model}}

View File

@ -91,9 +91,11 @@ this.{{name}} = {{name}};
/// {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{description}}{{/description}}
/// </summary>{{#description}}
/// <value>{{description}}</value>{{/description}}
[DataMember(Name="{{baseName}}", EmitDefaultValue={{emitDefaultValue}})]
[DataMember(Name="{{baseName}}", EmitDefaultValue={{emitDefaultValue}})]{{#isDate}}
[JsonConverter(typeof(SwaggerDateConverter))]{{/isDate}}
public {{{datatype}}} {{name}} { get; {{#isReadOnly}}private {{/isReadOnly}}set; }
{{/isEnum}}
{{/vars}}
/// <summary>
/// Returns the string presentation of the object

View File

@ -0,0 +1,22 @@
/**
* {{{description}}}
{{#vars}}
* @param {{name}} {{{description}}}
{{/vars}}
*/
data class {{classname}} (
{{#requiredVars}}
{{>data_class_req_var}}{{^-last}},
{{/-last}}{{/requiredVars}}{{#hasRequired}},
{{/hasRequired}}{{#optionalVars}}{{>data_class_opt_var}}{{^-last}},
{{/-last}}{{/optionalVars}}
) {
{{#hasEnums}}{{#vars}}{{#isEnum}}
enum class {{nameInCamelCase}}(val value: {{datatype}}) {
{{#_enum}}
{{{this}}}({{#isString}}"{{/isString}}{{{this}}}{{#isString}}"{{/isString}}){{^-last}},{{/-last}}{{#-last}};{{/-last}}
{{/_enum}}
}
{{/isEnum}}{{/vars}}{{/hasEnums}}
}

View File

@ -0,0 +1,4 @@
{{#description}}
/* {{{description}}} */
{{/description}}
val {{{name}}}: {{#isEnum}}{{classname}}.{{nameInCamelCase}}{{/isEnum}}{{^isEnum}}{{{datatype}}}{{/isEnum}}? = {{#defaultvalue}}{{defaultvalue}}{{/defaultvalue}}{{^defaultvalue}}null{{/defaultvalue}}

View File

@ -0,0 +1,4 @@
{{#description}}
/* {{{description}}} */
{{/description}}
val {{{name}}}: {{#isEnum}}{{classname}}.{{nameInCamelCase}}{{/isEnum}}{{^isEnum}}{{{datatype}}}{{/isEnum}}

View File

@ -0,0 +1,9 @@
/**
* {{{description}}}
* Values: {{#allowableValues}}{{#enumVars}}{{name}}{{^-last}},{{/-last}}{{/enumVars}}{{/allowableValues}}
*/
enum class {{classname}}(val value: {{dataType}}){
{{#allowableValues}}{{#enumVars}}
{{name}}({{#isString}}"{{/isString}}{{{value}}}{{#isString}}"{{/isString}}){{^-last}},{{/-last}}{{#-last}};{{/-last}}
{{/enumVars}}{{/allowableValues}}
)

View File

@ -6,19 +6,6 @@ package {{modelPackage}}
{{#models}}
{{#model}}
/**
* {{{description}}}
{{#vars}}
* @param {{name}} {{{description}}}
{{/vars}}
*/
data class {{classname}} (
{{#vars}}
{{#description}}
/* {{{description}}} */
{{/description}}
val {{{name}}}: {{{datatype}}}{{^required}}?{{/required}}{{#hasMore}},{{/hasMore}}
{{/vars}}
)
{{#isEnum}}{{>enum_class}}{{/isEnum}}{{^isEnum}}{{>data_class}}{{/isEnum}}
{{/model}}
{{/models}}

View File

@ -32,16 +32,18 @@ class ObjectSerializer
/**
* Serialize data
*
* @param mixed $data the data to serialize
* @param mixed $data the data to serialize
* @param string $type the SwaggerType of the data
* @param string $format the format of the Swagger type of the data
*
* @return string|object serialized form of $data
*/
public static function sanitizeForSerialization($data)
public static function sanitizeForSerialization($data, $type = null, $format = null)
{
if (is_scalar($data) || null === $data) {
return $data;
} elseif ($data instanceof \DateTime) {
return $data->format(\DateTime::ATOM);
return ($format === 'date') ? $data->format('Y-m-d') : $data->format(\DateTime::ATOM);
} elseif (is_array($data)) {
foreach ($data as $property => $value) {
$data[$property] = self::sanitizeForSerialization($value);
@ -49,6 +51,7 @@ class ObjectSerializer
return $data;
} elseif (is_object($data)) {
$values = [];
$formats = $data::swaggerFormats();
foreach ($data::swaggerTypes() as $property => $swaggerType) {
$getter = $data::getters()[$property];
$value = $data->$getter();
@ -58,7 +61,7 @@ class ObjectSerializer
throw new \InvalidArgumentException("Invalid value for enum '$swaggerType', must be one of: '$imploded'");
}
if ($value !== null) {
$values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($value);
$values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($value, $swaggerType, $formats[$property]);
}
}
return (object)$values;

View File

@ -74,8 +74,10 @@ use {{invokerPackage}}\ObjectSerializer;
{{#operation}}
/**
* Operation {{{operationId}}}
{{#summary}}
*
* {{{summary}}}
{{/summary}}
*
{{#description}}
* {{.}}
@ -96,8 +98,10 @@ use {{invokerPackage}}\ObjectSerializer;
/**
* Operation {{{operationId}}}WithHttpInfo
{{#summary}}
*
* {{{summary}}}
{{/summary}}
*
{{#description}}
* {{.}}

View File

@ -38,7 +38,6 @@ use \{{invokerPackage}}\ObjectSerializer;
*/
public static function setUpBeforeClass()
{
}
/**
@ -46,7 +45,6 @@ use \{{invokerPackage}}\ObjectSerializer;
*/
public function setUp()
{
}
/**
@ -54,7 +52,6 @@ use \{{invokerPackage}}\ObjectSerializer;
*/
public function tearDown()
{
}
/**
@ -62,10 +59,9 @@ use \{{invokerPackage}}\ObjectSerializer;
*/
public static function tearDownAfterClass()
{
}
{{#operation}}
/**
* Test case for {{{operationId}}}
*
@ -74,9 +70,7 @@ use \{{invokerPackage}}\ObjectSerializer;
*/
public function test{{vendorExtensions.x-testOperationId}}()
{
}
{{/operation}}
}
{{/operations}}

View File

@ -1,4 +1,5 @@
class {{classname}} {
class {{classname}}
{
/**
* Possible values of this enum
*/

View File

@ -17,11 +17,25 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple
{{/hasMore}}{{/vars}}
];
/**
* Array of property to format mappings. Used for (de)serialization
* @var string[]
*/
protected static $swaggerFormats = [
{{#vars}}'{{name}}' => {{#dataFormat}}'{{{dataFormat}}}'{{/dataFormat}}{{^dataFormat}}null{{/dataFormat}}{{#hasMore}},
{{/hasMore}}{{/vars}}
];
public static function swaggerTypes()
{
return self::$swaggerTypes{{#parentSchema}} + parent::swaggerTypes(){{/parentSchema}};
}
public static function swaggerFormats()
{
return self::$swaggerFormats{{#parentSchema}} + parent::swaggerFormats(){{/parentSchema}};
}
/**
* Array of attributes where the key is the local name, and the value is the original name
* @var string[]

View File

@ -39,7 +39,6 @@ class {{classname}}Test extends \PHPUnit_Framework_TestCase
*/
public static function setUpBeforeClass()
{
}
/**
@ -47,7 +46,6 @@ class {{classname}}Test extends \PHPUnit_Framework_TestCase
*/
public function setUp()
{
}
/**
@ -55,7 +53,6 @@ class {{classname}}Test extends \PHPUnit_Framework_TestCase
*/
public function tearDown()
{
}
/**
@ -63,7 +60,6 @@ class {{classname}}Test extends \PHPUnit_Framework_TestCase
*/
public static function tearDownAfterClass()
{
}
/**
@ -71,18 +67,15 @@ class {{classname}}Test extends \PHPUnit_Framework_TestCase
*/
public function test{{classname}}()
{
}
{{#vars}}
/**
* Test attribute "{{name}}"
*/
public function testProperty{{nameInCamelCase}}()
{
}
{{/vars}}
}
{{/model}}

View File

@ -0,0 +1,23 @@
# REST API Server for {{appName}}
## Overview
This API Server was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project.
It uses the [Restbed](https://github.com/Corvusoft/restbed) Framework.
## Installation
Put the package under your project folder and import the API stubs.
You need to complete the server stub, as it needs to be connected to a source.
## Libraries required
boost_system
ssl (if Restbed was built with SSL Support)
crypto
pthread
restbed
## Namespaces
io::swagger::server::api
io::swagger::server::model

View File

@ -0,0 +1,62 @@
{{>licenseInfo}}
{{#operations}}/*
* {{classname}}.h
*
* {{description}}
*/
#ifndef {{classname}}_H_
#define {{classname}}_H_
{{{defaultInclude}}}
#include <memory>
#include <corvusoft/restbed/session.hpp>
#include <corvusoft/restbed/resource.hpp>
#include <corvusoft/restbed/service.hpp>
{{#imports}}{{{import}}}
{{/imports}}
{{#apiNamespaceDeclarations}}
namespace {{this}} {
{{/apiNamespaceDeclarations}}
using namespace {{modelNamespace}};
class {{declspec}} {{classname}}: public restbed::Service
{
public:
{{classname}}();
~{{classname}}();
void startService(int const& port);
void stopService();
};
{{#operation}}
/// <summary>
/// {{summary}}
/// </summary>
/// <remarks>
/// {{notes}}
/// </remarks>
class {{declspec}} {{classname}}{{operationIdCamelCase}}Resource: public restbed::Resource
{
public:
{{classname}}{{operationIdCamelCase}}Resource();
virtual ~{{classname}}{{operationIdCamelCase}}Resource();
void {{httpMethod}}_method_handler(const std::shared_ptr<restbed::Session> session);
{{#vendorExtensions.x-codegen-otherMethods}}
void {{httpMethod}}_method_handler(const std::shared_ptr<restbed::Session> session);
{{/vendorExtensions.x-codegen-otherMethods}}
};
{{/operation}}
{{#apiNamespaceDeclarations}}
}
{{/apiNamespaceDeclarations}}
#endif /* {{classname}}_H_ */
{{/operations}}

View File

@ -0,0 +1,200 @@
{{>licenseInfo}}
{{#operations}}
#include <corvusoft/restbed/byte.hpp>
#include <corvusoft/restbed/string.hpp>
#include <corvusoft/restbed/settings.hpp>
#include <corvusoft/restbed/request.hpp>
#include "{{classname}}.h"
{{#apiNamespaceDeclarations}}
namespace {{this}} {
{{/apiNamespaceDeclarations}}
using namespace {{modelNamespace}};
{{classname}}::{{classname}}() {
{{#operation}}
std::shared_ptr<{{classname}}{{operationIdCamelCase}}Resource> sp{{classname}}{{operationIdCamelCase}}Resource = std::make_shared<{{classname}}{{operationIdCamelCase}}Resource>();
this->publish(sp{{classname}}{{operationIdCamelCase}}Resource);
{{/operation}}
}
{{classname}}::~{{classname}}() {}
void {{classname}}::startService(int const& port) {
std::shared_ptr<restbed::Settings> settings = std::make_shared<restbed::Settings>();
settings->set_port(port);
settings->set_root("{{contextPath}}");
this->start(settings);
}
void {{classname}}::stopService() {
this->stop();
}
{{#operation}}
{{classname}}{{operationIdCamelCase}}Resource::{{classname}}{{operationIdCamelCase}}Resource()
{
this->set_path("{{path}}");
this->set_method_handler("{{httpMethod}}",
std::bind(&{{classname}}{{operationIdCamelCase}}Resource::{{httpMethod}}_method_handler, this,
std::placeholders::_1));
{{#vendorExtensions.x-codegen-otherMethods}}
this->set_method_handler("{{httpMethod}}",
std::bind(&{{classname}}{{operationIdCamelCase}}Resource::{{httpMethod}}_method_handler, this,
std::placeholders::_1));
{{/vendorExtensions.x-codegen-otherMethods}}
}
{{classname}}{{operationIdCamelCase}}Resource::~{{classname}}{{operationIdCamelCase}}Resource()
{
}
void {{classname}}{{operationIdCamelCase}}Resource::{{httpMethod}}_method_handler(const std::shared_ptr<restbed::Session> session) {
const auto request = session->get_request();
{{#hasBodyParam}}
// Body params are present, therefore we have to fetch them
int content_length = request->get_header("Content-Length", 0);
session->fetch(content_length,
[ this ]( const std::shared_ptr<restbed::Session> session, const restbed::Bytes & body )
{
const auto request = session->get_request();
std::string requestBody = restbed::String::format("%.*s\n", ( int ) body.size( ), body.data( ));
/**
* Get body params or form params here from the requestBody string
*/
{{/hasBodyParam}}
{{#hasPathParams}}
// Getting the path params
{{#pathParams}}
{{#isPrimitiveType}}
const {{dataType}} {{paramName}} = request->get_path_parameter("{{paramName}}", {{#isString}}""{{/isString}}{{#isInteger}}0{{/isInteger}}{{#isLong}}0L{{/isLong}}{{#isFloat}}0.0f{{/isFloat}}{{#isDouble}}0.0{{/isDouble}});
{{/isPrimitiveType}}
{{/pathParams}}
{{/hasPathParams}}
{{#hasQueryParams}}
// Getting the query params
{{#queryParams}}
{{#isPrimitiveType}}
const {{dataType}} {{paramName}} = request->get_query_parameter("{{paramName}}", {{#isString}}""{{/isString}}{{#isInteger}}0{{/isInteger}}{{#isLong}}0L{{/isLong}}{{#isFloat}}0.0f{{/isFloat}}{{#isDouble}}0.0{{/isDouble}});
{{/isPrimitiveType}}
{{/queryParams}}
{{/hasQueryParams}}
{{#hasHeaderParams}}
// Getting the headers
{{#headerParams}}
{{#isPrimitiveType}}
const {{dataType}} {{paramName}} = request->get_header("{{paramName}}", {{#isString}}""{{/isString}}{{#isInteger}}0{{/isInteger}}{{#isLong}}0L{{/isLong}}{{#isFloat}}0.0f{{/isFloat}}{{#isDouble}}0.0{{/isDouble}});
{{/isPrimitiveType}}
{{/headerParams}}
{{/hasHeaderParams}}
// Change the value of this variable to the appropriate response before sending the response
int status_code = 200;
/**
* Process the received information here
*/
{{#responses}}
if (status_code == {{code}}) {
{{#headers}}
// Description: {{description}}
session->set_header("{{baseName}}", ""); // Change second param to your header value
{{/headers}}
session->close({{code}}, "{{message}}", { {"Connection", "close"} });
return;
}
{{/responses}}
{{#hasBodyParam}}
});
{{/hasBodyParam}}
}
{{#vendorExtensions.x-codegen-otherMethods}}
void {{classname}}{{operationIdCamelCase}}Resource::{{httpMethod}}_method_handler(const std::shared_ptr<restbed::Session> session) {
const auto request = session->get_request();
{{#hasBodyParam}}
// Body params are present, therefore we have to fetch them
int content_length = request->get_header("Content-Length", 0);
session->fetch(content_length,
[ this ]( const std::shared_ptr<restbed::Session> session, const restbed::Bytes & body )
{
const auto request = session->get_request();
std::string requestBody = restbed::String::format("%.*s\n", ( int ) body.size( ), body.data( ));
{{/hasBodyParam}}
{{#hasPathParams}}
// Getting the path params
{{#pathParams}}
{{#isPrimitiveType}}
const {{dataType}} {{paramName}} = request->get_path_parameter("{{paramName}}", {{#isString}}""{{/isString}}{{#isInteger}}0{{/isInteger}}{{#isLong}}0L{{/isLong}}{{#isFloat}}0.0f{{/isFloat}}{{#isDouble}}0.0{{/isDouble}});
{{/isPrimitiveType}}
{{/pathParams}}
{{/hasPathParams}}
{{#hasQueryParams}}
// Getting the query params
{{#queryParams}}
{{#isPrimitiveType}}
const {{dataType}} {{paramName}} = request->get_query_parameter("{{paramName}}", {{#isString}}""{{/isString}}{{#isInteger}}0{{/isInteger}}{{#isLong}}0L{{/isLong}}{{#isFloat}}0.0f{{/isFloat}}{{#isDouble}}0.0{{/isDouble}});
{{/isPrimitiveType}}
{{/queryParams}}
{{/hasQueryParams}}
{{#hasHeaderParams}}
// Getting the headers
{{#headerParams}}
{{#isPrimitiveType}}
const {{dataType}} {{paramName}} = request->get_header("{{paramName}}", {{#isString}}""{{/isString}}{{#isInteger}}0{{/isInteger}}{{#isLong}}0L{{/isLong}}{{#isFloat}}0.0f{{/isFloat}}{{#isDouble}}0.0{{/isDouble}});
{{/isPrimitiveType}}
{{/headerParams}}
{{/hasHeaderParams}}
// Change the value of this variable to the appropriate response before sending the response
int status_code = 200;
/**
* Process the received information here
*/
{{#responses}}
if (status_code == {{code}}) {
{{#baseType}}
std::shared_ptr<{{.}}> response = NULL;
{{/baseType}}
{{#headers}}
// Description: {{description}}
session->set_header("{{baseName}}", ""); // Change second param to your header value
{{/headers}}
session->close({{code}}, "{{message}}", { {"Connection", "close"} });
return;
}
{{/responses}}
{{#hasBodyParam}}
});
{{/hasBodyParam}}
}
{{/vendorExtensions.x-codegen-otherMethods}}
{{/operation}}
{{#apiNamespaceDeclarations}}
}
{{/apiNamespaceDeclarations}}
{{/operations}}

View File

@ -0,0 +1,51 @@
#!/bin/sh
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
#
# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-cpprest "minor update"
git_user_id=$1
git_repo_id=$2
release_note=$3
if [ "$git_user_id" = "" ]; then
git_user_id="{{{gitUserId}}}"
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
fi
if [ "$git_repo_id" = "" ]; then
git_repo_id="{{{gitRepoId}}}"
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
fi
if [ "$release_note" = "" ]; then
release_note="{{{releaseNote}}}"
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
fi
# Initialize the local directory as a Git repository
git init
# Adds the files in the local repository and stages them for commit.
git add .
# Commits the tracked changes and prepares them to be pushed to a remote repository.
git commit -m "$release_note"
# Sets the new remote
git_remote=`git remote`
if [ "$git_remote" = "" ]; then # git remote not defined
if [ "$GIT_TOKEN" = "" ]; then
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment."
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
else
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
fi
fi
git pull origin master
# Pushes (Forces) the changes in the local repository up to the remote repository
echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
git push origin master 2>&1 | grep -v 'To https'

View File

@ -0,0 +1,29 @@
# Compiled Object files
*.slo
*.lo
*.o
*.obj
# Precompiled Headers
*.gch
*.pch
# Compiled Dynamic libraries
*.so
*.dylib
*.dll
# Fortran module files
*.mod
*.smod
# Compiled Static libraries
*.lai
*.la
*.a
*.lib
# Executables
*.exe
*.out
*.app

View File

@ -0,0 +1,11 @@
/**
* {{{appName}}}
* {{{appDescription}}}
*
* {{#version}}OpenAPI spec version: {{{version}}}{{/version}}
* {{#infoEmail}}Contact: {{{infoEmail}}}{{/infoEmail}}
*
* 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.
*/

View File

@ -0,0 +1,58 @@
{{>licenseInfo}}
{{#models}}{{#model}}/*
* {{classname}}.h
*
* {{description}}
*/
#ifndef {{classname}}_H_
#define {{classname}}_H_
{{{defaultInclude}}}
{{#imports}}{{{this}}}
{{/imports}}
#include <memory>
{{#modelNamespaceDeclarations}}
namespace {{this}} {
{{/modelNamespaceDeclarations}}
/// <summary>
/// {{description}}
/// </summary>
class {{declspec}} {{classname}}
{
public:
{{classname}}();
virtual ~{{classname}}();
std::string toJsonString();
void fromJsonString(std::string const& jsonString);
/////////////////////////////////////////////
/// {{classname}} members
{{#vars}}
/// <summary>
/// {{description}}
/// </summary>
{{^isNotContainer}}{{{datatype}}}& {{getter}}();
{{/isNotContainer}}{{#isNotContainer}}{{{datatype}}} {{getter}}() const;
void {{setter}}({{{datatype}}} value);
{{/isNotContainer}}
{{/vars}}
protected:
{{#vars}}
{{{datatype}}} m_{{name}};
{{/vars}}
};
{{#modelNamespaceDeclarations}}
}
{{/modelNamespaceDeclarations}}
#endif /* {{classname}}_H_ */
{{/model}}
{{/models}}

View File

@ -0,0 +1,96 @@
{{>licenseInfo}}
{{#models}}{{#model}}
#include "{{classname}}.h"
#include <string>
#include <sstream>
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/json_parser.hpp>
using boost::property_tree::ptree;
using boost::property_tree::read_json;
using boost::property_tree::write_json;
{{#modelNamespaceDeclarations}}
namespace {{this}} {
{{/modelNamespaceDeclarations}}
{{classname}}::{{classname}}()
{
{{#vars}}{{#isNotContainer}}{{#isPrimitiveType}}m_{{name}} = {{{defaultValue}}};
{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isString}}m_{{name}} = {{{defaultValue}}};
{{/isString}}{{#isDateTime}}m_{{name}} = {{{defaultValue}}};
{{/isDateTime}}{{/isPrimitiveType}}{{/isNotContainer}}{{/vars}}
}
{{classname}}::~{{classname}}()
{
}
std::string {{classname}}::toJsonString()
{
std::stringstream ss;
ptree pt;
{{#vars}}
{{#isNotContainer}}
{{#isPrimitiveType}}
pt.put("{{name}}", m_{{name}});
{{/isPrimitiveType}}
{{^isPrimitiveType}}
{{#isString}}
pt.put("{{name}}", m_{{name}});
{{/isString}}
{{#isDateTime}}
pt.put("{{name}}", m_{{name}});
{{/isDateTime}}
{{/isPrimitiveType}}
{{/isNotContainer}}
{{/vars}}
write_json(ss, pt, false);
return ss.str();
}
void {{classname}}::fromJsonString(std::string const& jsonString)
{
std::stringstream ss(jsonString);
ptree pt;
read_json(ss,pt);
{{#vars}}
{{#isNotContainer}}
{{#isPrimitiveType}}
m_{{name}} = pt.get("{{name}}", {{{defaultValue}}});
{{/isPrimitiveType}}
{{^isPrimitiveType}}
{{#isString}}
m_{{name}} = pt.get("{{name}}", {{{defaultValue}}});
{{/isString}}
{{#isDateTime}}
m_{{name}} = pt.get("{{name}}", {{{defaultValue}}});
{{/isDateTime}}
{{/isPrimitiveType}}
{{/isNotContainer}}
{{/vars}}
}
{{#vars}}{{^isNotContainer}}{{{datatype}}}& {{classname}}::{{getter}}()
{
return m_{{name}};
}
{{/isNotContainer}}{{#isNotContainer}}{{{datatype}}} {{classname}}::{{getter}}() const
{
return m_{{name}};
}
void {{classname}}::{{setter}}({{{datatype}}} value)
{
m_{{name}} = value;
}
{{/isNotContainer}}
{{/vars}}
{{#modelNamespaceDeclarations}}
}
{{/modelNamespaceDeclarations}}
{{/model}}
{{/models}}

View File

@ -19,7 +19,7 @@ require 'json'
end
describe 'test an instance of {{classname}}' do
it 'should create an instact of {{classname}}' do
it 'should create an instance of {{classname}}' do
expect(@instance).to be_instance_of({{moduleName}}::{{classname}})
end
end

View File

@ -20,7 +20,7 @@ require 'date'
end
describe 'test an instance of {{classname}}' do
it 'should create an instact of {{classname}}' do
it 'should create an instance of {{classname}}' do
expect(@instance).to be_instance_of({{moduleName}}::{{classname}})
end
end

View File

@ -27,10 +27,10 @@ Pod::Spec.new do |s|
{{/podDocumentationURL}}
s.source_files = '{{projectName}}/Classes/Swaggers/**/*.swift'
{{#usePromiseKit}}
s.dependency 'PromiseKit', '~> 3.1.1'
s.dependency 'PromiseKit', '~> 3.5.3'
{{/usePromiseKit}}
{{#useRxSwift}}
s.dependency 'RxSwift', '~> 2.0'
s.dependency 'RxSwift', '~> 2.6.1'
{{/useRxSwift}}
s.dependency 'Alamofire', '~> 3.4.1'
s.dependency 'Alamofire', '~> 3.5.1'
end

View File

@ -15,7 +15,7 @@ Pod::Spec.new do |s|
s.screenshots = {{& podScreenshots}}{{/podScreenshots}}{{#podDocumentationURL}}
s.documentation_url = '{{podDocumentationURL}}'{{/podDocumentationURL}}
s.source_files = '{{projectName}}/Classes/Swaggers/**/*.swift'{{#usePromiseKit}}
s.dependency 'PromiseKit', '~> 4.0'{{/usePromiseKit}}{{#useRxSwift}}
s.dependency 'RxSwift', '~> 3.0.0-beta.1'{{/useRxSwift}}
s.dependency 'PromiseKit', '~> 4.2.2'{{/usePromiseKit}}{{#useRxSwift}}
s.dependency 'RxSwift', '~> 3.4.1'{{/useRxSwift}}
s.dependency 'Alamofire', '~> 4.0'
end

View File

@ -80,7 +80,7 @@ open class {{classname}}: APIBase {
}
observer.on(.completed)
}
return NopDisposable.instance
return Disposables.create()
}
}
{{/useRxSwift}}

View File

@ -112,7 +112,8 @@
<goal>wget</goal>
</goals>
<configuration>
<url>https://github.com/swagger-api/swagger-ui/archive/master.tar.gz</url>
<url>http://github.com/swagger-api/swagger-ui/archive/master.tar.gz</url>
<unpack>true</unpack>
<skipCache>true</skipCache>
<outputDirectory>${project.build.directory}</outputDirectory>

44
pom.xml
View File

@ -792,22 +792,18 @@
</activation>
<modules>
<!-- clients -->
<module>samples/client/petstore/clojure</module>
<module>samples/client/petstore/java/feign</module>
<module>samples/client/petstore/java/jersey1</module>
<module>samples/client/petstore/java/jersey2</module>
<module>samples/client/petstore/java/okhttp-gson</module>
<module>samples/client/petstore/java/retrofit</module>
<module>samples/client/petstore/java/retrofit2</module>
<module>samples/client/petstore/java/retrofit2rx</module>
<module>samples/client/petstore/jaxrs-cxf-client</module>
<!--<module>samples/client/petstore/java/resttemplate</module>-->
<module>samples/client/petstore/ruby</module>
<module>samples/client/petstore/swift3/default/SwaggerClientTests</module>
<module>samples/client/petstore/swift3/promisekit/SwaggerClientTests</module>
<module>samples/client/petstore/swift3/rxswift/SwaggerClientTests</module>
<module>samples/client/petstore/swift/default/SwaggerClientTests</module>
<module>samples/client/petstore/swift/promisekit/SwaggerClientTests</module>
<module>samples/client/petstore/swift/rxswift/SwaggerClientTests</module>
<!--<module>samples/client/petstore/objc/default/SwaggerClientTests</module>
<module>samples/client/petstore/objc/core-data/SwaggerClientTests</module>
<module>samples/client/petstore/bash</module>-->
<module>samples/client/petstore/scala</module>
<module>samples/client/petstore/akka-scala</module>
<module>samples/client/petstore/ruby</module>
<module>samples/client/petstore/android/volley</module>
<module>samples/client/petstore/bash</module>
<module>samples/client/petstore/go</module>
<module>samples/client/petstore/javascript</module>
<module>samples/client/petstore/python</module>
<module>samples/client/petstore/typescript-fetch/builds/default</module>
@ -817,28 +813,8 @@
<module>samples/client/petstore/typescript-angular</module>
<module>samples/client/petstore/typescript-node/npm</module>
<module>samples/client/petstore/typescript-jquery/npm</module>
<!--module>samples/client/petstore/objc/SwaggerClientTests</module-->
<!--module>samples/client/petstore/swift/SwaggerClientTests</module-->
<!-- servers -->
<module>samples/server/petstore/java-inflector</module>
<module>samples/server/petstore/java-play-framework</module>
<module>samples/server/petstore/undertow</module>
<module>samples/server/petstore/jaxrs/jersey1</module>
<module>samples/server/petstore/jaxrs/jersey2</module>
<module>samples/server/petstore/jaxrs-resteasy/default</module>
<module>samples/server/petstore/jaxrs-resteasy/eap</module>
<module>samples/server/petstore/jaxrs-resteasy/eap-joda</module>
<module>samples/server/petstore/jaxrs-resteasy/joda</module>
<module>samples/server/petstore/scalatra</module>
<module>samples/server/petstore/spring-mvc</module>
<module>samples/client/petstore/spring-cloud</module>
<module>samples/server/petstore/springboot</module>
<module>samples/server/petstore/springboot-beanvalidation</module>
<module>samples/server/petstore/jaxrs-cxf</module>
<module>samples/server/petstore/jaxrs-cxf-annotated-base-path</module>
<module>samples/server/petstore/jaxrs-cxf-cdi</module>
<module>samples/server/petstore/jaxrs-cxf-non-spring-app</module>
<!--<module>samples/server/petstore/java-msf4j</module> note: JDK8 only -->
<!-- <module>samples/server/petstore/erlang-server</module> note: make sample compilation work -->
</modules>
</profile>

View File

@ -792,6 +792,8 @@
</activation>
<modules>
<!-- clients -->
<module>samples/client/petstore/go</module>
<!-- test java-related projects -->
<module>samples/client/petstore/clojure</module>
<module>samples/client/petstore/java/feign</module>
<module>samples/client/petstore/java/jersey1</module>
@ -801,26 +803,10 @@
<module>samples/client/petstore/java/retrofit2</module>
<module>samples/client/petstore/java/retrofit2rx</module>
<module>samples/client/petstore/jaxrs-cxf-client</module>
<!--<module>samples/client/petstore/java/resttemplate</module>-->
<!-- only test java-related projects
<module>samples/client/petstore/scala</module>
<module>samples/client/petstore/akka-scala</module>
<module>samples/client/petstore/java/resttemplate</module>
<module>samples/client/petstore/ruby</module>
<module>samples/client/petstore/android/volley</module>
<module>samples/client/petstore/bash</module>
<module>samples/client/petstore/go</module>
<module>samples/client/petstore/javascript</module>
<module>samples/client/petstore/python</module>
<module>samples/client/petstore/typescript-fetch/builds/default</module>
<module>samples/client/petstore/typescript-fetch/builds/es6-target</module>
<module>samples/client/petstore/typescript-fetch/builds/with-npm-version</module>
<module>samples/client/petstore/typescript-fetch/tests/default</module>
<module>samples/client/petstore/typescript-angular</module>
<module>samples/client/petstore/typescript-node/npm</module>
<module>samples/client/petstore/typescript-jquery/npm</module>
-->
<!--module>samples/client/petstore/objc/SwaggerClientTests</module-->
<!--module>samples/client/petstore/swift/SwaggerClientTests</module-->
<!-- comment out bash as it's failing after switching to CircleCI
<module>samples/client/petstore/bash</module> -->
<!-- servers -->
<module>samples/server/petstore/java-inflector</module>
<module>samples/server/petstore/java-play-framework</module>
@ -831,17 +817,15 @@
<module>samples/server/petstore/jaxrs-resteasy/eap</module>
<module>samples/server/petstore/jaxrs-resteasy/eap-joda</module>
<module>samples/server/petstore/jaxrs-resteasy/joda</module>
<!--<module>samples/server/petstore/scalatra</module>-->
<module>samples/server/petstore/spring-mvc</module>
<!-- comment out due to change in method signature
<module>samples/client/petstore/spring-cloud</module> -->
<module>samples/client/petstore/spring-cloud</module>
<module>samples/server/petstore/springboot</module>
<module>samples/server/petstore/springboot-beanvalidation</module>
<module>samples/server/petstore/jaxrs-cxf</module>
<module>samples/server/petstore/jaxrs-cxf-annotated-base-path</module>
<module>samples/server/petstore/jaxrs-cxf-cdi</module>
<module>samples/server/petstore/jaxrs-cxf-non-spring-app</module>
<!--<module>samples/server/petstore/java-msf4j</module> note: JDK8 only -->
<module>samples/server/petstore/java-msf4j</module>
</modules>
</profile>
</profiles>

View File

@ -0,0 +1 @@
2.2.3-SNAPSHOT

View File

@ -14,9 +14,14 @@
package io.swagger.client.model;
import java.util.Objects;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
/**
* Model for testing reserved words *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r

View File

@ -1 +1,5 @@
2.3.0-SNAPSHOT
<<<<<<< HEAD
2.3.0-SNAPSHOT
=======
2.2.3-SNAPSHOT
>>>>>>> origin/master

View File

@ -0,0 +1,371 @@
<?php
/**
* ApiClient
*
* PHP version 5
*
* @category Class
* @package Swagger\Client
* @author Swagger Codegen team
* @link https://github.com/swagger-api/swagger-codegen
*/
/**
* Swagger Petstore *_/ ' \" =end -- \\r\\n \\n \\r
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end --
*
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
* Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*
*/
/**
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen
* Do not edit the class manually.
*/
namespace Swagger\Client;
/**
* ApiClient Class Doc Comment
*
* @category Class
* @package Swagger\Client
* @author Swagger Codegen team
* @link https://github.com/swagger-api/swagger-codegen
*/
class ApiClient
{
public static $PATCH = "PATCH";
public static $POST = "POST";
public static $GET = "GET";
public static $HEAD = "HEAD";
public static $OPTIONS = "OPTIONS";
public static $PUT = "PUT";
public static $DELETE = "DELETE";
/**
* Configuration
*
* @var Configuration
*/
protected $config;
/**
* Object Serializer
*
* @var ObjectSerializer
*/
protected $serializer;
/**
* Constructor of the class
*
* @param Configuration $config config for this ApiClient
*/
public function __construct(\Swagger\Client\Configuration $config = null)
{
if ($config === null) {
$config = Configuration::getDefaultConfiguration();
}
$this->config = $config;
$this->serializer = new ObjectSerializer();
}
/**
* Get the config
*
* @return Configuration
*/
public function getConfig()
{
return $this->config;
}
/**
* Get the serializer
*
* @return ObjectSerializer
*/
public function getSerializer()
{
return $this->serializer;
}
/**
* Get API key (with prefix if set)
*
* @param string $apiKeyIdentifier name of apikey
*
* @return string API key with the prefix
*/
public function getApiKeyWithPrefix($apiKeyIdentifier)
{
$prefix = $this->config->getApiKeyPrefix($apiKeyIdentifier);
$apiKey = $this->config->getApiKey($apiKeyIdentifier);
if (!isset($apiKey)) {
return null;
}
if (isset($prefix)) {
$keyWithPrefix = $prefix." ".$apiKey;
} else {
$keyWithPrefix = $apiKey;
}
return $keyWithPrefix;
}
/**
* Make the HTTP call (Sync)
*
* @param string $resourcePath path to method endpoint
* @param string $method method to call
* @param array $queryParams parameters to be place in query URL
* @param array $postData parameters to be placed in POST body
* @param array $headerParams parameters to be place in request header
* @param string $responseType expected response type of the endpoint
* @param string $endpointPath path to method endpoint before expanding parameters
*
* @throws \Swagger\Client\ApiException on a non 2xx response
* @return mixed
*/
public function callApi($resourcePath, $method, $queryParams, $postData, $headerParams, $responseType = null, $endpointPath = null)
{
$headers = [];
// construct the http header
$headerParams = array_merge(
(array)$this->config->getDefaultHeaders(),
(array)$headerParams
);
foreach ($headerParams as $key => $val) {
$headers[] = "$key: $val";
}
// form data
if ($postData and in_array('Content-Type: application/x-www-form-urlencoded', $headers, true)) {
$postData = http_build_query($postData);
} elseif ((is_object($postData) or is_array($postData)) and !in_array('Content-Type: multipart/form-data', $headers, true)) { // json model
$postData = json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($postData));
}
$url = $this->config->getHost() . $resourcePath;
$curl = curl_init();
// set timeout, if needed
if ($this->config->getCurlTimeout() !== 0) {
curl_setopt($curl, CURLOPT_TIMEOUT, $this->config->getCurlTimeout());
}
// set connect timeout, if needed
if ($this->config->getCurlConnectTimeout() != 0) {
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, $this->config->getCurlConnectTimeout());
}
// return the result on success, rather than just true
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
// disable SSL verification, if needed
if ($this->config->getSSLVerification() === false) {
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
}
if ($this->config->getCurlProxyHost()) {
curl_setopt($curl, CURLOPT_PROXY, $this->config->getCurlProxyHost());
}
if ($this->config->getCurlProxyPort()) {
curl_setopt($curl, CURLOPT_PROXYPORT, $this->config->getCurlProxyPort());
}
if ($this->config->getCurlProxyType()) {
curl_setopt($curl, CURLOPT_PROXYTYPE, $this->config->getCurlProxyType());
}
if ($this->config->getCurlProxyUser()) {
curl_setopt($curl, CURLOPT_PROXYUSERPWD, $this->config->getCurlProxyUser() . ':' .$this->config->getCurlProxyPassword());
}
if (!empty($queryParams)) {
$url = ($url . '?' . http_build_query($queryParams));
}
if ($this->config->getAllowEncoding()) {
curl_setopt($curl, CURLOPT_ENCODING, '');
}
if ($method === self::$POST) {
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $postData);
} elseif ($method === self::$HEAD) {
curl_setopt($curl, CURLOPT_NOBODY, true);
} elseif ($method === self::$OPTIONS) {
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "OPTIONS");
curl_setopt($curl, CURLOPT_POSTFIELDS, $postData);
} elseif ($method === self::$PATCH) {
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_setopt($curl, CURLOPT_POSTFIELDS, $postData);
} elseif ($method === self::$PUT) {
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($curl, CURLOPT_POSTFIELDS, $postData);
} elseif ($method === self::$DELETE) {
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_setopt($curl, CURLOPT_POSTFIELDS, $postData);
} elseif ($method !== self::$GET) {
throw new ApiException('Method ' . $method . ' is not recognized.');
}
curl_setopt($curl, CURLOPT_URL, $url);
// Set user agent
curl_setopt($curl, CURLOPT_USERAGENT, $this->config->getUserAgent());
// debugging for curl
if ($this->config->getDebug()) {
error_log("[DEBUG] HTTP Request body ~BEGIN~".PHP_EOL.print_r($postData, true).PHP_EOL."~END~".PHP_EOL, 3, $this->config->getDebugFile());
curl_setopt($curl, CURLOPT_VERBOSE, 1);
curl_setopt($curl, CURLOPT_STDERR, fopen($this->config->getDebugFile(), 'a'));
} else {
curl_setopt($curl, CURLOPT_VERBOSE, 0);
}
// obtain the HTTP response headers
curl_setopt($curl, CURLOPT_HEADER, 1);
// Make the request
$response = curl_exec($curl);
$http_header_size = curl_getinfo($curl, CURLINFO_HEADER_SIZE);
$http_header = $this->httpParseHeaders(substr($response, 0, $http_header_size));
$http_body = substr($response, $http_header_size);
$response_info = curl_getinfo($curl);
// debug HTTP response body
if ($this->config->getDebug()) {
error_log("[DEBUG] HTTP Response body ~BEGIN~".PHP_EOL.print_r($http_body, true).PHP_EOL."~END~".PHP_EOL, 3, $this->config->getDebugFile());
}
// Handle the response
if ($response_info['http_code'] === 0) {
$curl_error_message = curl_error($curl);
// curl_exec can sometimes fail but still return a blank message from curl_error().
if (!empty($curl_error_message)) {
$error_message = "API call to $url failed: $curl_error_message";
} else {
$error_message = "API call to $url failed, but for an unknown reason. " .
"This could happen if you are disconnected from the network.";
}
$exception = new ApiException($error_message, 0, null, null);
$exception->setResponseObject($response_info);
throw $exception;
} elseif ($response_info['http_code'] >= 200 && $response_info['http_code'] <= 299) {
// return raw body if response is a file
if ($responseType === '\SplFileObject' || $responseType === 'string') {
return [$http_body, $response_info['http_code'], $http_header];
}
$data = json_decode($http_body);
if (json_last_error() > 0) { // if response is a string
$data = $http_body;
}
} else {
$data = json_decode($http_body);
if (json_last_error() > 0) { // if response is a string
$data = $http_body;
}
throw new ApiException(
"[".$response_info['http_code']."] Error connecting to the API ($url)",
$response_info['http_code'],
$http_header,
$data
);
}
return [$data, $response_info['http_code'], $http_header];
}
/**
* Return the header 'Accept' based on an array of Accept provided
*
* @param string[] $accept Array of header
*
* @return string Accept (e.g. application/json)
*/
public function selectHeaderAccept($accept)
{
if (count($accept) === 0 or (count($accept) === 1 and $accept[0] === '')) {
return null;
} elseif (preg_grep("/application\/json/i", $accept)) {
return 'application/json';
} else {
return implode(',', $accept);
}
}
/**
* Return the content type based on an array of content-type provided
*
* @param string[] $content_type Array fo content-type
*
* @return string Content-Type (e.g. application/json)
*/
public function selectHeaderContentType($content_type)
{
if (count($content_type) === 0 or (count($content_type) === 1 and $content_type[0] === '')) {
return 'application/json';
} elseif (preg_grep("/application\/json/i", $content_type)) {
return 'application/json';
} else {
return implode(',', $content_type);
}
}
/**
* Return an array of HTTP response headers
*
* @param string $raw_headers A string of raw HTTP response headers
*
* @return string[] Array of HTTP response heaers
*/
protected function httpParseHeaders($raw_headers)
{
// ref/credit: http://php.net/manual/en/function.http-parse-headers.php#112986
$headers = [];
$key = '';
foreach (explode("\n", $raw_headers) as $h) {
$h = explode(':', $h, 2);
if (isset($h[1])) {
if (!isset($headers[$h[0]])) {
$headers[$h[0]] = trim($h[1]);
} elseif (is_array($headers[$h[0]])) {
$headers[$h[0]] = array_merge($headers[$h[0]], [trim($h[1])]);
} else {
$headers[$h[0]] = array_merge([$headers[$h[0]]], [trim($h[1])]);
}
$key = $h[0];
} else {
if (substr($h[0], 0, 1) === "\t") {
$headers[$key] .= "\r\n\t".trim($h[0]);
} elseif (!$key) {
$headers[0] = trim($h[0]);
}
trim($h[0]);
}
}
return $headers;
}
}

View File

@ -112,6 +112,61 @@ class Configuration
protected $tempFolderPath;
/**
<<<<<<< HEAD
=======
* Indicates if SSL verification should be enabled or disabled.
*
* This is useful if the host uses a self-signed SSL certificate.
*
* @var boolean True if the certificate should be validated, false otherwise.
*/
protected $sslVerification = true;
/**
* Curl proxy host
*
* @var string
*/
protected $proxyHost;
/**
* Curl proxy port
*
* @var integer
*/
protected $proxyPort;
/**
* Curl proxy type, e.g. CURLPROXY_HTTP or CURLPROXY_SOCKS5
*
* @see https://secure.php.net/manual/en/function.curl-setopt.php
* @var integer
*/
protected $proxyType;
/**
* Curl proxy username
*
* @var string
*/
protected $proxyUser;
/**
* Curl proxy password
*
* @var string
*/
protected $proxyPassword;
/**
* Allow Curl encoding header
*
* @var bool
*/
protected $allowEncoding = false;
/**
>>>>>>> origin/master
* Constructor
*/
public function __construct()
@ -292,6 +347,200 @@ class Configuration
}
/**
<<<<<<< HEAD
=======
* Sets the HTTP timeout value
*
* @param integer $seconds Number of seconds before timing out [set to 0 for no timeout]
*
* @throws \InvalidArgumentException
* @return $this
*/
public function setCurlTimeout($seconds)
{
if (!is_numeric($seconds) || $seconds < 0) {
throw new \InvalidArgumentException('Timeout value must be numeric and a non-negative number.');
}
$this->curlTimeout = $seconds;
return $this;
}
/**
* Gets the HTTP timeout value
*
* @return string HTTP timeout value
*/
public function getCurlTimeout()
{
return $this->curlTimeout;
}
/**
* Sets the HTTP connect timeout value
*
* @param integer $seconds Number of seconds before connection times out [set to 0 for no timeout]
*
* @throws \InvalidArgumentException
* @return $this
*/
public function setCurlConnectTimeout($seconds)
{
if (!is_numeric($seconds) || $seconds < 0) {
throw new \InvalidArgumentException('Connect timeout value must be numeric and a non-negative number.');
}
$this->curlConnectTimeout = $seconds;
return $this;
}
/**
* Set whether to accept encoding
* @param bool $allowEncoding
*/
public function setAllowEncoding($allowEncoding)
{
$this->allowEncoding = $allowEncoding;
return $this;
}
/**
* Gets the HTTP connect timeout value
*
* @return string HTTP connect timeout value
*/
public function getCurlConnectTimeout()
{
return $this->curlConnectTimeout;
}
/**
* Get whether to allow encoding
*
* @return bool
*/
public function getAllowEncoding()
{
return $this->allowEncoding;
}
/**
* Sets the HTTP Proxy Host
*
* @param string $proxyHost HTTP Proxy URL
*
* @return $this
*/
public function setCurlProxyHost($proxyHost)
{
$this->proxyHost = $proxyHost;
return $this;
}
/**
* Gets the HTTP Proxy Host
*
* @return string
*/
public function getCurlProxyHost()
{
return $this->proxyHost;
}
/**
* Sets the HTTP Proxy Port
*
* @param integer $proxyPort HTTP Proxy Port
*
* @return $this
*/
public function setCurlProxyPort($proxyPort)
{
$this->proxyPort = $proxyPort;
return $this;
}
/**
* Gets the HTTP Proxy Port
*
* @return integer
*/
public function getCurlProxyPort()
{
return $this->proxyPort;
}
/**
* Sets the HTTP Proxy Type
*
* @param integer $proxyType HTTP Proxy Type
*
* @return $this
*/
public function setCurlProxyType($proxyType)
{
$this->proxyType = $proxyType;
return $this;
}
/**
* Gets the HTTP Proxy Type
*
* @return integer
*/
public function getCurlProxyType()
{
return $this->proxyType;
}
/**
* Sets the HTTP Proxy User
*
* @param string $proxyUser HTTP Proxy User
*
* @return $this
*/
public function setCurlProxyUser($proxyUser)
{
$this->proxyUser = $proxyUser;
return $this;
}
/**
* Gets the HTTP Proxy User
*
* @return string
*/
public function getCurlProxyUser()
{
return $this->proxyUser;
}
/**
* Sets the HTTP Proxy Password
*
* @param string $proxyPassword HTTP Proxy Password
*
* @return $this
*/
public function setCurlProxyPassword($proxyPassword)
{
$this->proxyPassword = $proxyPassword;
return $this;
}
/**
* Gets the HTTP Proxy Password
*
* @return string
*/
public function getCurlProxyPassword()
{
return $this->proxyPassword;
}
/**
>>>>>>> origin/master
* Sets debug flag
*
* @param bool $debug Debug flag

View File

@ -58,11 +58,24 @@ class ModelReturn implements ArrayAccess
'return' => 'int'
];
/**
* Array of property to format mappings. Used for (de)serialization
* @var string[]
*/
protected static $swaggerFormats = [
'return' => 'int32'
];
public static function swaggerTypes()
{
return self::$swaggerTypes;
}
public static function swaggerFormats()
{
return self::$swaggerFormats;
}
/**
* Array of attributes where the key is the local name, and the value is the original name
* @var string[]

View File

@ -42,16 +42,18 @@ class ObjectSerializer
/**
* Serialize data
*
* @param mixed $data the data to serialize
* @param mixed $data the data to serialize
* @param string $type the SwaggerType of the data
* @param string $format the format of the Swagger type of the data
*
* @return string|object serialized form of $data
*/
public static function sanitizeForSerialization($data)
public static function sanitizeForSerialization($data, $type = null, $format = null)
{
if (is_scalar($data) || null === $data) {
return $data;
} elseif ($data instanceof \DateTime) {
return $data->format(\DateTime::ATOM);
return ($format === 'date') ? $data->format('Y-m-d') : $data->format(\DateTime::ATOM);
} elseif (is_array($data)) {
foreach ($data as $property => $value) {
$data[$property] = self::sanitizeForSerialization($value);
@ -59,6 +61,7 @@ class ObjectSerializer
return $data;
} elseif (is_object($data)) {
$values = [];
$formats = $data::swaggerFormats();
foreach ($data::swaggerTypes() as $property => $swaggerType) {
$getter = $data::getters()[$property];
$value = $data->$getter();
@ -68,7 +71,7 @@ class ObjectSerializer
throw new \InvalidArgumentException("Invalid value for enum '$swaggerType', must be one of: '$imploded'");
}
if ($value !== null) {
$values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($value);
$values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($value, $swaggerType, $formats[$property]);
}
}
return (object)$values;

View File

@ -38,7 +38,7 @@ describe 'FakeApi' do
end
describe 'test an instance of FakeApi' do
it 'should create an instact of FakeApi' do
it 'should create an instance of FakeApi' do
expect(@instance).to be_instance_of(Petstore::FakeApi)
end
end

View File

@ -39,7 +39,7 @@ describe 'ModelReturn' do
end
describe 'test an instance of ModelReturn' do
it 'should create an instact of ModelReturn' do
it 'should create an instance of ModelReturn' do
expect(@instance).to be_instance_of(Petstore::ModelReturn)
end
end

View File

@ -8,6 +8,7 @@ using IO.Swagger.Api;
using IO.Swagger.Model;
using IO.Swagger.Client;
using System.Reflection;
using Newtonsoft.Json;
namespace IO.Swagger.Test
{
@ -128,7 +129,23 @@ namespace IO.Swagger.Test
[Test]
public void DateTest()
{
// TODO: unit test for the property 'Date'
var item = new FormatTest(Integer: 1,
Int32: 1,
Int64: 1,
Number: 1,
_Float: 1.0f,
_Double: 1.0d,
_String: "",
_Byte: new byte[0],
Binary: null,
Date: new DateTime(year: 2000, month: 5, day: 13),
DateTime: null,
Uuid: null,
Password: "");
var serialized = JsonConvert.SerializeObject(item);
Console.WriteLine(serialized);
Assert.Greater(serialized.IndexOf("\"2000-05-13\""), 0);
}
/// <summary>
/// Test the property 'DateTime'

View File

@ -0,0 +1,30 @@
/*
* 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 Newtonsoft.Json.Converters;
namespace IO.Swagger.Client
{
/// <summary>
/// Formatter for 'date' swagger formats ss defined by full-date - RFC3339
/// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types
/// </summary>
public class SwaggerDateConverter : IsoDateTimeConverter
{
/// <summary>
/// Initializes a new instance of the <see cref="SwaggerDateConverter" /> class.
/// </summary>
public SwaggerDateConverter()
{
// full-date = date-fullyear "-" date-month "-" date-mday
DateTimeFormat = "yyyy-MM-dd";
}
}
}

View File

@ -20,6 +20,7 @@ using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.ComponentModel.DataAnnotations;
using SwaggerDateConverter = IO.Swagger.Client.SwaggerDateConverter;
namespace IO.Swagger.Model
{
@ -45,11 +46,13 @@ namespace IO.Swagger.Model
/// </summary>
[DataMember(Name="map_property", EmitDefaultValue=false)]
public Dictionary<string, string> MapProperty { get; set; }
/// <summary>
/// Gets or Sets MapOfMapProperty
/// </summary>
[DataMember(Name="map_of_map_property", EmitDefaultValue=false)]
public Dictionary<string, Dictionary<string, string>> MapOfMapProperty { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>

View File

@ -20,6 +20,7 @@ using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.ComponentModel.DataAnnotations;
using SwaggerDateConverter = IO.Swagger.Client.SwaggerDateConverter;
namespace IO.Swagger.Model
{
@ -66,11 +67,13 @@ namespace IO.Swagger.Model
/// </summary>
[DataMember(Name="className", EmitDefaultValue=false)]
public string ClassName { get; set; }
/// <summary>
/// Gets or Sets Color
/// </summary>
[DataMember(Name="color", EmitDefaultValue=false)]
public string Color { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>

View File

@ -20,6 +20,7 @@ using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.ComponentModel.DataAnnotations;
using SwaggerDateConverter = IO.Swagger.Client.SwaggerDateConverter;
namespace IO.Swagger.Model
{

View File

@ -20,6 +20,7 @@ using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.ComponentModel.DataAnnotations;
using SwaggerDateConverter = IO.Swagger.Client.SwaggerDateConverter;
namespace IO.Swagger.Model
{
@ -47,16 +48,19 @@ namespace IO.Swagger.Model
/// </summary>
[DataMember(Name="code", EmitDefaultValue=false)]
public int? Code { get; set; }
/// <summary>
/// Gets or Sets Type
/// </summary>
[DataMember(Name="type", EmitDefaultValue=false)]
public string Type { get; set; }
/// <summary>
/// Gets or Sets Message
/// </summary>
[DataMember(Name="message", EmitDefaultValue=false)]
public string Message { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>

View File

@ -20,6 +20,7 @@ using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.ComponentModel.DataAnnotations;
using SwaggerDateConverter = IO.Swagger.Client.SwaggerDateConverter;
namespace IO.Swagger.Model
{
@ -43,6 +44,7 @@ namespace IO.Swagger.Model
/// </summary>
[DataMember(Name="ArrayArrayNumber", EmitDefaultValue=false)]
public List<List<decimal?>> ArrayArrayNumber { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>

View File

@ -20,6 +20,7 @@ using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.ComponentModel.DataAnnotations;
using SwaggerDateConverter = IO.Swagger.Client.SwaggerDateConverter;
namespace IO.Swagger.Model
{
@ -43,6 +44,7 @@ namespace IO.Swagger.Model
/// </summary>
[DataMember(Name="ArrayNumber", EmitDefaultValue=false)]
public List<decimal?> ArrayNumber { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>

View File

@ -20,6 +20,7 @@ using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.ComponentModel.DataAnnotations;
using SwaggerDateConverter = IO.Swagger.Client.SwaggerDateConverter;
namespace IO.Swagger.Model
{
@ -47,16 +48,19 @@ namespace IO.Swagger.Model
/// </summary>
[DataMember(Name="array_of_string", EmitDefaultValue=false)]
public List<string> ArrayOfString { get; set; }
/// <summary>
/// Gets or Sets ArrayArrayOfInteger
/// </summary>
[DataMember(Name="array_array_of_integer", EmitDefaultValue=false)]
public List<List<long?>> ArrayArrayOfInteger { get; set; }
/// <summary>
/// Gets or Sets ArrayArrayOfModel
/// </summary>
[DataMember(Name="array_array_of_model", EmitDefaultValue=false)]
public List<List<ReadOnlyFirst>> ArrayArrayOfModel { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>

View File

@ -20,6 +20,7 @@ using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.ComponentModel.DataAnnotations;
using SwaggerDateConverter = IO.Swagger.Client.SwaggerDateConverter;
namespace IO.Swagger.Model
{
@ -53,32 +54,38 @@ namespace IO.Swagger.Model
/// </summary>
[DataMember(Name="smallCamel", EmitDefaultValue=false)]
public string SmallCamel { get; set; }
/// <summary>
/// Gets or Sets CapitalCamel
/// </summary>
[DataMember(Name="CapitalCamel", EmitDefaultValue=false)]
public string CapitalCamel { get; set; }
/// <summary>
/// Gets or Sets SmallSnake
/// </summary>
[DataMember(Name="small_Snake", EmitDefaultValue=false)]
public string SmallSnake { get; set; }
/// <summary>
/// Gets or Sets CapitalSnake
/// </summary>
[DataMember(Name="Capital_Snake", EmitDefaultValue=false)]
public string CapitalSnake { get; set; }
/// <summary>
/// Gets or Sets SCAETHFlowPoints
/// </summary>
[DataMember(Name="SCA_ETH_Flow_Points", EmitDefaultValue=false)]
public string SCAETHFlowPoints { get; set; }
/// <summary>
/// Name of the pet
/// </summary>
/// <value>Name of the pet </value>
[DataMember(Name="ATT_NAME", EmitDefaultValue=false)]
public string ATT_NAME { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>

View File

@ -20,6 +20,7 @@ using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.ComponentModel.DataAnnotations;
using SwaggerDateConverter = IO.Swagger.Client.SwaggerDateConverter;
namespace IO.Swagger.Model
{
@ -68,16 +69,19 @@ namespace IO.Swagger.Model
/// </summary>
[DataMember(Name="className", EmitDefaultValue=false)]
public string ClassName { get; set; }
/// <summary>
/// Gets or Sets Color
/// </summary>
[DataMember(Name="color", EmitDefaultValue=false)]
public string Color { get; set; }
/// <summary>
/// Gets or Sets Declawed
/// </summary>
[DataMember(Name="declawed", EmitDefaultValue=false)]
public bool? Declawed { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>

View File

@ -20,6 +20,7 @@ using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.ComponentModel.DataAnnotations;
using SwaggerDateConverter = IO.Swagger.Client.SwaggerDateConverter;
namespace IO.Swagger.Model
{
@ -45,11 +46,13 @@ namespace IO.Swagger.Model
/// </summary>
[DataMember(Name="id", EmitDefaultValue=false)]
public long? Id { get; set; }
/// <summary>
/// Gets or Sets Name
/// </summary>
[DataMember(Name="name", EmitDefaultValue=false)]
public string Name { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>

View File

@ -20,6 +20,7 @@ using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.ComponentModel.DataAnnotations;
using SwaggerDateConverter = IO.Swagger.Client.SwaggerDateConverter;
namespace IO.Swagger.Model
{
@ -43,6 +44,7 @@ namespace IO.Swagger.Model
/// </summary>
[DataMember(Name="_class", EmitDefaultValue=false)]
public string _Class { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>

View File

@ -20,6 +20,7 @@ using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.ComponentModel.DataAnnotations;
using SwaggerDateConverter = IO.Swagger.Client.SwaggerDateConverter;
namespace IO.Swagger.Model
{
@ -68,16 +69,19 @@ namespace IO.Swagger.Model
/// </summary>
[DataMember(Name="className", EmitDefaultValue=false)]
public string ClassName { get; set; }
/// <summary>
/// Gets or Sets Color
/// </summary>
[DataMember(Name="color", EmitDefaultValue=false)]
public string Color { get; set; }
/// <summary>
/// Gets or Sets Breed
/// </summary>
[DataMember(Name="breed", EmitDefaultValue=false)]
public string Breed { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>

View File

@ -20,6 +20,7 @@ using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.ComponentModel.DataAnnotations;
using SwaggerDateConverter = IO.Swagger.Client.SwaggerDateConverter;
namespace IO.Swagger.Model
{
@ -91,6 +92,8 @@ namespace IO.Swagger.Model
this.ArrayEnum = ArrayEnum;
}
/// <summary>
/// Returns the string presentation of the object
/// </summary>

View File

@ -20,6 +20,7 @@ using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.ComponentModel.DataAnnotations;
using SwaggerDateConverter = IO.Swagger.Client.SwaggerDateConverter;
namespace IO.Swagger.Model
{

View File

@ -20,6 +20,7 @@ using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.ComponentModel.DataAnnotations;
using SwaggerDateConverter = IO.Swagger.Client.SwaggerDateConverter;
namespace IO.Swagger.Model
{
@ -125,11 +126,15 @@ namespace IO.Swagger.Model
this.OuterEnum = OuterEnum;
}
/// <summary>
/// Gets or Sets OuterEnum
/// </summary>
[DataMember(Name="outerEnum", EmitDefaultValue=false)]
public OuterEnum OuterEnum { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>

View File

@ -20,6 +20,7 @@ using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.ComponentModel.DataAnnotations;
using SwaggerDateConverter = IO.Swagger.Client.SwaggerDateConverter;
namespace IO.Swagger.Model
{
@ -104,66 +105,80 @@ namespace IO.Swagger.Model
/// </summary>
[DataMember(Name="integer", EmitDefaultValue=false)]
public int? Integer { get; set; }
/// <summary>
/// Gets or Sets Int32
/// </summary>
[DataMember(Name="int32", EmitDefaultValue=false)]
public int? Int32 { get; set; }
/// <summary>
/// Gets or Sets Int64
/// </summary>
[DataMember(Name="int64", EmitDefaultValue=false)]
public long? Int64 { get; set; }
/// <summary>
/// Gets or Sets Number
/// </summary>
[DataMember(Name="number", EmitDefaultValue=false)]
public decimal? Number { get; set; }
/// <summary>
/// Gets or Sets _Float
/// </summary>
[DataMember(Name="float", EmitDefaultValue=false)]
public float? _Float { get; set; }
/// <summary>
/// Gets or Sets _Double
/// </summary>
[DataMember(Name="double", EmitDefaultValue=false)]
public double? _Double { get; set; }
/// <summary>
/// Gets or Sets _String
/// </summary>
[DataMember(Name="string", EmitDefaultValue=false)]
public string _String { get; set; }
/// <summary>
/// Gets or Sets _Byte
/// </summary>
[DataMember(Name="byte", EmitDefaultValue=false)]
public byte[] _Byte { get; set; }
/// <summary>
/// Gets or Sets Binary
/// </summary>
[DataMember(Name="binary", EmitDefaultValue=false)]
public byte[] Binary { get; set; }
/// <summary>
/// Gets or Sets Date
/// </summary>
[DataMember(Name="date", EmitDefaultValue=false)]
[JsonConverter(typeof(SwaggerDateConverter))]
public DateTime? Date { get; set; }
/// <summary>
/// Gets or Sets DateTime
/// </summary>
[DataMember(Name="dateTime", EmitDefaultValue=false)]
public DateTime? DateTime { get; set; }
/// <summary>
/// Gets or Sets Uuid
/// </summary>
[DataMember(Name="uuid", EmitDefaultValue=false)]
public Guid? Uuid { get; set; }
/// <summary>
/// Gets or Sets Password
/// </summary>
[DataMember(Name="password", EmitDefaultValue=false)]
public string Password { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>

View File

@ -20,6 +20,7 @@ using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.ComponentModel.DataAnnotations;
using SwaggerDateConverter = IO.Swagger.Client.SwaggerDateConverter;
namespace IO.Swagger.Model
{
@ -42,11 +43,13 @@ namespace IO.Swagger.Model
/// </summary>
[DataMember(Name="bar", EmitDefaultValue=false)]
public string Bar { get; private set; }
/// <summary>
/// Gets or Sets Foo
/// </summary>
[DataMember(Name="foo", EmitDefaultValue=false)]
public string Foo { get; private set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>

View File

@ -20,6 +20,7 @@ using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.ComponentModel.DataAnnotations;
using SwaggerDateConverter = IO.Swagger.Client.SwaggerDateConverter;
namespace IO.Swagger.Model
{
@ -43,6 +44,7 @@ namespace IO.Swagger.Model
/// </summary>
[DataMember(Name="123-list", EmitDefaultValue=false)]
public string _123List { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>

View File

@ -20,6 +20,7 @@ using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.ComponentModel.DataAnnotations;
using SwaggerDateConverter = IO.Swagger.Client.SwaggerDateConverter;
namespace IO.Swagger.Model
{
@ -71,6 +72,8 @@ namespace IO.Swagger.Model
/// </summary>
[DataMember(Name="map_map_of_string", EmitDefaultValue=false)]
public Dictionary<string, Dictionary<string, string>> MapMapOfString { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>

View File

@ -20,6 +20,7 @@ using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.ComponentModel.DataAnnotations;
using SwaggerDateConverter = IO.Swagger.Client.SwaggerDateConverter;
namespace IO.Swagger.Model
{
@ -47,16 +48,19 @@ namespace IO.Swagger.Model
/// </summary>
[DataMember(Name="uuid", EmitDefaultValue=false)]
public Guid? Uuid { get; set; }
/// <summary>
/// Gets or Sets DateTime
/// </summary>
[DataMember(Name="dateTime", EmitDefaultValue=false)]
public DateTime? DateTime { get; set; }
/// <summary>
/// Gets or Sets Map
/// </summary>
[DataMember(Name="map", EmitDefaultValue=false)]
public Dictionary<string, Animal> Map { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>

View File

@ -20,6 +20,7 @@ using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.ComponentModel.DataAnnotations;
using SwaggerDateConverter = IO.Swagger.Client.SwaggerDateConverter;
namespace IO.Swagger.Model
{
@ -45,11 +46,13 @@ namespace IO.Swagger.Model
/// </summary>
[DataMember(Name="name", EmitDefaultValue=false)]
public int? Name { get; set; }
/// <summary>
/// Gets or Sets _Class
/// </summary>
[DataMember(Name="class", EmitDefaultValue=false)]
public string _Class { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>

View File

@ -20,6 +20,7 @@ using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.ComponentModel.DataAnnotations;
using SwaggerDateConverter = IO.Swagger.Client.SwaggerDateConverter;
namespace IO.Swagger.Model
{
@ -43,6 +44,7 @@ namespace IO.Swagger.Model
/// </summary>
[DataMember(Name="client", EmitDefaultValue=false)]
public string _Client { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>

View File

@ -20,6 +20,7 @@ using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.ComponentModel.DataAnnotations;
using SwaggerDateConverter = IO.Swagger.Client.SwaggerDateConverter;
namespace IO.Swagger.Model
{
@ -43,6 +44,7 @@ namespace IO.Swagger.Model
/// </summary>
[DataMember(Name="return", EmitDefaultValue=false)]
public int? _Return { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>

View File

@ -20,6 +20,7 @@ using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.ComponentModel.DataAnnotations;
using SwaggerDateConverter = IO.Swagger.Client.SwaggerDateConverter;
namespace IO.Swagger.Model
{
@ -58,21 +59,25 @@ namespace IO.Swagger.Model
/// </summary>
[DataMember(Name="name", EmitDefaultValue=false)]
public int? _Name { get; set; }
/// <summary>
/// Gets or Sets SnakeCase
/// </summary>
[DataMember(Name="snake_case", EmitDefaultValue=false)]
public int? SnakeCase { get; private set; }
/// <summary>
/// Gets or Sets Property
/// </summary>
[DataMember(Name="property", EmitDefaultValue=false)]
public string Property { get; set; }
/// <summary>
/// Gets or Sets _123Number
/// </summary>
[DataMember(Name="123Number", EmitDefaultValue=false)]
public int? _123Number { get; private set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>

View File

@ -20,6 +20,7 @@ using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.ComponentModel.DataAnnotations;
using SwaggerDateConverter = IO.Swagger.Client.SwaggerDateConverter;
namespace IO.Swagger.Model
{
@ -43,6 +44,7 @@ namespace IO.Swagger.Model
/// </summary>
[DataMember(Name="JustNumber", EmitDefaultValue=false)]
public decimal? JustNumber { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>

View File

@ -20,6 +20,7 @@ using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.ComponentModel.DataAnnotations;
using SwaggerDateConverter = IO.Swagger.Client.SwaggerDateConverter;
namespace IO.Swagger.Model
{
@ -94,26 +95,32 @@ namespace IO.Swagger.Model
/// </summary>
[DataMember(Name="id", EmitDefaultValue=false)]
public long? Id { get; set; }
/// <summary>
/// Gets or Sets PetId
/// </summary>
[DataMember(Name="petId", EmitDefaultValue=false)]
public long? PetId { get; set; }
/// <summary>
/// Gets or Sets Quantity
/// </summary>
[DataMember(Name="quantity", EmitDefaultValue=false)]
public int? Quantity { get; set; }
/// <summary>
/// Gets or Sets ShipDate
/// </summary>
[DataMember(Name="shipDate", EmitDefaultValue=false)]
public DateTime? ShipDate { get; set; }
/// <summary>
/// Gets or Sets Complete
/// </summary>
[DataMember(Name="complete", EmitDefaultValue=false)]
public bool? Complete { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>

View File

@ -20,6 +20,7 @@ using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.ComponentModel.DataAnnotations;
using SwaggerDateConverter = IO.Swagger.Client.SwaggerDateConverter;
namespace IO.Swagger.Model
{

View File

@ -20,6 +20,7 @@ using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.ComponentModel.DataAnnotations;
using SwaggerDateConverter = IO.Swagger.Client.SwaggerDateConverter;
namespace IO.Swagger.Model
{
@ -47,16 +48,19 @@ namespace IO.Swagger.Model
/// </summary>
[DataMember(Name="my_number", EmitDefaultValue=false)]
public OuterNumber MyNumber { get; set; }
/// <summary>
/// Gets or Sets MyString
/// </summary>
[DataMember(Name="my_string", EmitDefaultValue=false)]
public OuterString MyString { get; set; }
/// <summary>
/// Gets or Sets MyBoolean
/// </summary>
[DataMember(Name="my_boolean", EmitDefaultValue=false)]
public OuterBoolean MyBoolean { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>

View File

@ -20,6 +20,7 @@ using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.ComponentModel.DataAnnotations;
using SwaggerDateConverter = IO.Swagger.Client.SwaggerDateConverter;
namespace IO.Swagger.Model
{

View File

@ -20,6 +20,7 @@ using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.ComponentModel.DataAnnotations;
using SwaggerDateConverter = IO.Swagger.Client.SwaggerDateConverter;
namespace IO.Swagger.Model
{

View File

@ -20,6 +20,7 @@ using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.ComponentModel.DataAnnotations;
using SwaggerDateConverter = IO.Swagger.Client.SwaggerDateConverter;
namespace IO.Swagger.Model
{

View File

@ -20,6 +20,7 @@ using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.ComponentModel.DataAnnotations;
using SwaggerDateConverter = IO.Swagger.Client.SwaggerDateConverter;
namespace IO.Swagger.Model
{
@ -107,26 +108,32 @@ namespace IO.Swagger.Model
/// </summary>
[DataMember(Name="id", EmitDefaultValue=false)]
public long? Id { get; set; }
/// <summary>
/// Gets or Sets Category
/// </summary>
[DataMember(Name="category", EmitDefaultValue=false)]
public Category Category { get; set; }
/// <summary>
/// Gets or Sets Name
/// </summary>
[DataMember(Name="name", EmitDefaultValue=false)]
public string Name { get; set; }
/// <summary>
/// Gets or Sets PhotoUrls
/// </summary>
[DataMember(Name="photoUrls", EmitDefaultValue=false)]
public List<string> PhotoUrls { get; set; }
/// <summary>
/// Gets or Sets Tags
/// </summary>
[DataMember(Name="tags", EmitDefaultValue=false)]
public List<Tag> Tags { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>

View File

@ -20,6 +20,7 @@ using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.ComponentModel.DataAnnotations;
using SwaggerDateConverter = IO.Swagger.Client.SwaggerDateConverter;
namespace IO.Swagger.Model
{
@ -43,11 +44,13 @@ namespace IO.Swagger.Model
/// </summary>
[DataMember(Name="bar", EmitDefaultValue=false)]
public string Bar { get; private set; }
/// <summary>
/// Gets or Sets Baz
/// </summary>
[DataMember(Name="baz", EmitDefaultValue=false)]
public string Baz { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>

View File

@ -20,6 +20,7 @@ using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.ComponentModel.DataAnnotations;
using SwaggerDateConverter = IO.Swagger.Client.SwaggerDateConverter;
namespace IO.Swagger.Model
{
@ -43,6 +44,7 @@ namespace IO.Swagger.Model
/// </summary>
[DataMember(Name="$special[property.name]", EmitDefaultValue=false)]
public long? SpecialPropertyName { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>

View File

@ -20,6 +20,7 @@ using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.ComponentModel.DataAnnotations;
using SwaggerDateConverter = IO.Swagger.Client.SwaggerDateConverter;
namespace IO.Swagger.Model
{
@ -45,11 +46,13 @@ namespace IO.Swagger.Model
/// </summary>
[DataMember(Name="id", EmitDefaultValue=false)]
public long? Id { get; set; }
/// <summary>
/// Gets or Sets Name
/// </summary>
[DataMember(Name="name", EmitDefaultValue=false)]
public string Name { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>

View File

@ -20,6 +20,7 @@ using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.ComponentModel.DataAnnotations;
using SwaggerDateConverter = IO.Swagger.Client.SwaggerDateConverter;
namespace IO.Swagger.Model
{
@ -57,42 +58,50 @@ namespace IO.Swagger.Model
/// </summary>
[DataMember(Name="id", EmitDefaultValue=false)]
public long? Id { get; set; }
/// <summary>
/// Gets or Sets Username
/// </summary>
[DataMember(Name="username", EmitDefaultValue=false)]
public string Username { get; set; }
/// <summary>
/// Gets or Sets FirstName
/// </summary>
[DataMember(Name="firstName", EmitDefaultValue=false)]
public string FirstName { get; set; }
/// <summary>
/// Gets or Sets LastName
/// </summary>
[DataMember(Name="lastName", EmitDefaultValue=false)]
public string LastName { get; set; }
/// <summary>
/// Gets or Sets Email
/// </summary>
[DataMember(Name="email", EmitDefaultValue=false)]
public string Email { get; set; }
/// <summary>
/// Gets or Sets Password
/// </summary>
[DataMember(Name="password", EmitDefaultValue=false)]
public string Password { get; set; }
/// <summary>
/// Gets or Sets Phone
/// </summary>
[DataMember(Name="phone", EmitDefaultValue=false)]
public string Phone { get; set; }
/// <summary>
/// User Status
/// </summary>
/// <value>User Status</value>
[DataMember(Name="userStatus", EmitDefaultValue=false)]
public int? UserStatus { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>

View File

@ -0,0 +1,30 @@
/*
* 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 Newtonsoft.Json.Converters;
namespace IO.Swagger.Client
{
/// <summary>
/// Formatter for 'date' swagger formats ss defined by full-date - RFC3339
/// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types
/// </summary>
public class SwaggerDateConverter : IsoDateTimeConverter
{
/// <summary>
/// Initializes a new instance of the <see cref="SwaggerDateConverter" /> class.
/// </summary>
public SwaggerDateConverter()
{
// full-date = date-fullyear "-" date-month "-" date-mday
DateTimeFormat = "yyyy-MM-dd";
}
}
}

View File

@ -18,6 +18,7 @@ using System.Collections.ObjectModel;
using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using SwaggerDateConverter = IO.Swagger.Client.SwaggerDateConverter;
namespace IO.Swagger.Model
{
@ -43,11 +44,13 @@ namespace IO.Swagger.Model
/// </summary>
[DataMember(Name="map_property", EmitDefaultValue=false)]
public Dictionary<string, string> MapProperty { get; set; }
/// <summary>
/// Gets or Sets MapOfMapProperty
/// </summary>
[DataMember(Name="map_of_map_property", EmitDefaultValue=false)]
public Dictionary<string, Dictionary<string, string>> MapOfMapProperty { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>

View File

@ -18,6 +18,7 @@ using System.Collections.ObjectModel;
using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using SwaggerDateConverter = IO.Swagger.Client.SwaggerDateConverter;
namespace IO.Swagger.Model
{
@ -64,11 +65,13 @@ namespace IO.Swagger.Model
/// </summary>
[DataMember(Name="className", EmitDefaultValue=false)]
public string ClassName { get; set; }
/// <summary>
/// Gets or Sets Color
/// </summary>
[DataMember(Name="color", EmitDefaultValue=false)]
public string Color { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>

View File

@ -18,6 +18,7 @@ using System.Collections.ObjectModel;
using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using SwaggerDateConverter = IO.Swagger.Client.SwaggerDateConverter;
namespace IO.Swagger.Model
{

View File

@ -18,6 +18,7 @@ using System.Collections.ObjectModel;
using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using SwaggerDateConverter = IO.Swagger.Client.SwaggerDateConverter;
namespace IO.Swagger.Model
{
@ -45,16 +46,19 @@ namespace IO.Swagger.Model
/// </summary>
[DataMember(Name="code", EmitDefaultValue=false)]
public int? Code { get; set; }
/// <summary>
/// Gets or Sets Type
/// </summary>
[DataMember(Name="type", EmitDefaultValue=false)]
public string Type { get; set; }
/// <summary>
/// Gets or Sets Message
/// </summary>
[DataMember(Name="message", EmitDefaultValue=false)]
public string Message { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>

View File

@ -18,6 +18,7 @@ using System.Collections.ObjectModel;
using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using SwaggerDateConverter = IO.Swagger.Client.SwaggerDateConverter;
namespace IO.Swagger.Model
{
@ -41,6 +42,7 @@ namespace IO.Swagger.Model
/// </summary>
[DataMember(Name="ArrayArrayNumber", EmitDefaultValue=false)]
public List<List<decimal?>> ArrayArrayNumber { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>

Some files were not shown because too many files have changed in this diff Show More