forked from loafle/openapi-generator-original
Merge branch 'master' into swift_case_sensitive_reserved_types
# Conflicts: # modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SwiftCodegen.java
This commit is contained in:
commit
c87e6d6f41
@ -6,6 +6,8 @@
|
|||||||
|
|
||||||
:star::star::star: If you would like to contribute, please refer to [guidelines](https://github.com/swagger-api/swagger-codegen/blob/master/CONTRIBUTING.md) and a list of [open tasks](https://github.com/swagger-api/swagger-codegen/issues?q=is%3Aopen+is%3Aissue+label%3A%22Need+community+contribution%22).:star::star::star:
|
:star::star::star: If you would like to contribute, please refer to [guidelines](https://github.com/swagger-api/swagger-codegen/blob/master/CONTRIBUTING.md) and a list of [open tasks](https://github.com/swagger-api/swagger-codegen/issues?q=is%3Aopen+is%3Aissue+label%3A%22Need+community+contribution%22).:star::star::star:
|
||||||
|
|
||||||
|
:notebook_with_decorative_cover: For more information, please refer to the [Wiki page](https://github.com/swagger-api/swagger-codegen/wiki) and [FAQ](https://github.com/swagger-api/swagger-codegen/wiki/FAQ) :notebook_with_decorative_cover:
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
This is the swagger codegen project, which allows generation of client libraries automatically from a Swagger-compliant server.
|
This is the swagger codegen project, which allows generation of client libraries automatically from a Swagger-compliant server.
|
||||||
|
|
||||||
@ -565,7 +567,7 @@ You can also use the codegen to generate a server for a couple different framewo
|
|||||||
```
|
```
|
||||||
java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate \
|
java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate \
|
||||||
-i http://petstore.swagger.io/v2/swagger.json \
|
-i http://petstore.swagger.io/v2/swagger.json \
|
||||||
-l nodejs \
|
-l nodejs-server \
|
||||||
-o samples/server/petstore/nodejs
|
-o samples/server/petstore/nodejs
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -26,6 +26,6 @@ fi
|
|||||||
|
|
||||||
# if you've executed sbt assembly previously it will use that instead.
|
# if you've executed sbt assembly previously it will use that instead.
|
||||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
ags="$@ generate -t modules/swagger-codegen/src/main/resources/akka-scala -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l akka-scala -o samples/client/petstore/akka-scala"
|
ags="$@ generate -t modules/swagger-codegen/src/main/resources/akka-scala -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l akka-scala -o samples/client/petstore/akka-scala"
|
||||||
|
|
||||||
java $JAVA_OPTS -jar $executable $ags
|
java $JAVA_OPTS -jar $executable $ags
|
||||||
|
@ -1,24 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
SCRIPT="$0"
|
|
||||||
|
|
||||||
while [ -h "$SCRIPT" ] ; do
|
|
||||||
ls=`ls -ld "$SCRIPT"`
|
|
||||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
|
||||||
if expr "$link" : '/.*' > /dev/null; then
|
|
||||||
SCRIPT="$link"
|
|
||||||
else
|
|
||||||
SCRIPT=`dirname "$SCRIPT"`/"$link"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ ! -d "${APP_DIR}" ]; then
|
|
||||||
APP_DIR=`dirname "$SCRIPT"`/..
|
|
||||||
APP_DIR=`cd "${APP_DIR}"; pwd`
|
|
||||||
fi
|
|
||||||
|
|
||||||
cd $APP_DIR
|
|
||||||
./bin/android-java-wordnik-api.sh
|
|
||||||
./bin/java-wordnik-api.sh
|
|
||||||
./bin/objc-wordnik-api.sh
|
|
||||||
./bin/scala-wordnik-api.sh
|
|
@ -1,31 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
SCRIPT="$0"
|
|
||||||
|
|
||||||
while [ -h "$SCRIPT" ] ; do
|
|
||||||
ls=`ls -ld "$SCRIPT"`
|
|
||||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
|
||||||
if expr "$link" : '/.*' > /dev/null; then
|
|
||||||
SCRIPT="$link"
|
|
||||||
else
|
|
||||||
SCRIPT=`dirname "$SCRIPT"`/"$link"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ ! -d "${APP_DIR}" ]; then
|
|
||||||
APP_DIR=`dirname "$SCRIPT"`/..
|
|
||||||
APP_DIR=`cd "${APP_DIR}"; pwd`
|
|
||||||
fi
|
|
||||||
|
|
||||||
executable="./modules/swagger-codegen-cli/target/swagger-codegen-cli.jar"
|
|
||||||
|
|
||||||
if [ ! -f "$executable" ]
|
|
||||||
then
|
|
||||||
mvn clean package
|
|
||||||
fi
|
|
||||||
|
|
||||||
# if you've executed sbt assembly previously it will use that instead.
|
|
||||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
|
||||||
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/wordnik.json -l android -o samples/client/wordnik/android-java"
|
|
||||||
|
|
||||||
java $JAVA_OPTS -jar $executable $ags
|
|
@ -26,6 +26,6 @@ fi
|
|||||||
|
|
||||||
# if you've executed sbt assembly previously it will use that instead.
|
# if you've executed sbt assembly previously it will use that instead.
|
||||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
ags="$@ generate -l aspnet5 -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -o samples/server/petstore/aspnet5"
|
ags="$@ generate -l aspnet5 -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -o samples/server/petstore/aspnet5"
|
||||||
|
|
||||||
java $JAVA_OPTS -jar $executable $ags
|
java $JAVA_OPTS -jar $executable $ags
|
||||||
|
@ -26,6 +26,6 @@ fi
|
|||||||
|
|
||||||
# if you've executed sbt assembly previously it will use that instead.
|
# if you've executed sbt assembly previously it will use that instead.
|
||||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l CsharpDotNet2 -o samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient"
|
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l CsharpDotNet2 -o samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient"
|
||||||
|
|
||||||
java $JAVA_OPTS -jar $executable $ags
|
java $JAVA_OPTS -jar $executable $ags
|
||||||
|
@ -26,6 +26,6 @@ fi
|
|||||||
|
|
||||||
# if you've executed sbt assembly previously it will use that instead.
|
# if you've executed sbt assembly previously it will use that instead.
|
||||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l csharp -o samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient"
|
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l csharp -o samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient"
|
||||||
|
|
||||||
java $JAVA_OPTS -jar $executable $ags
|
java $JAVA_OPTS -jar $executable $ags
|
||||||
|
@ -26,6 +26,6 @@ fi
|
|||||||
|
|
||||||
# if you've executed sbt assembly previously it will use that instead.
|
# if you've executed sbt assembly previously it will use that instead.
|
||||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l dart -o samples/client/petstore/dart"
|
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l dart -o samples/client/petstore/dart"
|
||||||
|
|
||||||
java $JAVA_OPTS -jar $executable $ags
|
java $JAVA_OPTS -jar $executable $ags
|
||||||
|
@ -26,6 +26,6 @@ fi
|
|||||||
|
|
||||||
# if you've executed sbt assembly previously it will use that instead.
|
# if you've executed sbt assembly previously it will use that instead.
|
||||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l dynamic-html -o samples/dynamic-html"
|
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l dynamic-html -o samples/dynamic-html"
|
||||||
|
|
||||||
java $JAVA_OPTS -jar $executable $ags
|
java $JAVA_OPTS -jar $executable $ags
|
||||||
|
@ -26,6 +26,6 @@ fi
|
|||||||
|
|
||||||
# if you've executed sbt assembly previously it will use that instead.
|
# if you've executed sbt assembly previously it will use that instead.
|
||||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
ags="$@ generate -t modules/swagger-codegen/src/main/resources/flash -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l flash -o samples/client/petstore/flash"
|
ags="$@ generate -t modules/swagger-codegen/src/main/resources/flash -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l flash -o samples/client/petstore/flash"
|
||||||
|
|
||||||
java $JAVA_OPTS -jar $executable $ags
|
java $JAVA_OPTS -jar $executable $ags
|
||||||
|
@ -26,6 +26,6 @@ fi
|
|||||||
|
|
||||||
# if you've executed sbt assembly previously it will use that instead.
|
# if you've executed sbt assembly previously it will use that instead.
|
||||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l python-flask -o samples/server/petstore/flaskConnexion "
|
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l python-flask -o samples/server/petstore/flaskConnexion "
|
||||||
|
|
||||||
java $JAVA_OPTS -Dservice -jar $executable $ags
|
java $JAVA_OPTS -Dservice -jar $executable $ags
|
||||||
|
@ -26,6 +26,6 @@ fi
|
|||||||
|
|
||||||
# if you've executed sbt assembly previously it will use that instead.
|
# if you've executed sbt assembly previously it will use that instead.
|
||||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
ags="$@ generate -t modules/swagger-codegen/src/main/resources/go -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l go -o samples/client/petstore/go"
|
ags="$@ generate -t modules/swagger-codegen/src/main/resources/go -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l go -o samples/client/petstore/go/go-petstore"
|
||||||
|
|
||||||
java $JAVA_OPTS -jar $executable $ags
|
java $JAVA_OPTS -jar $executable $ags
|
||||||
|
@ -26,6 +26,6 @@ fi
|
|||||||
|
|
||||||
# if you've executed sbt assembly previously it will use that instead.
|
# if you've executed sbt assembly previously it will use that instead.
|
||||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
ags="$@ generate -t modules/swagger-codegen/src/main/resources/haskell-servant -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l haskell-servant -o samples/server/petstore/haskell-servant"
|
ags="$@ generate -t modules/swagger-codegen/src/main/resources/haskell-servant -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l haskell-servant -o samples/server/petstore/haskell-servant"
|
||||||
|
|
||||||
java $JAVA_OPTS -jar $executable $ags
|
java $JAVA_OPTS -jar $executable $ags
|
||||||
|
@ -26,6 +26,6 @@ fi
|
|||||||
|
|
||||||
# if you've executed sbt assembly previously it will use that instead.
|
# if you've executed sbt assembly previously it will use that instead.
|
||||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l html -o samples/html"
|
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l html -o samples/html"
|
||||||
|
|
||||||
java $JAVA_OPTS -jar $executable $ags
|
java $JAVA_OPTS -jar $executable $ags
|
||||||
|
@ -26,6 +26,6 @@ fi
|
|||||||
|
|
||||||
# if you've executed sbt assembly previously it will use that instead.
|
# if you've executed sbt assembly previously it will use that instead.
|
||||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
ags="$@ generate -t modules/swagger-codegen/src/main/resources/JavaInflector -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l inflector -o samples/server/petstore/java-inflector"
|
ags="$@ generate -t modules/swagger-codegen/src/main/resources/JavaInflector -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l inflector -o samples/server/petstore/java-inflector"
|
||||||
|
|
||||||
java $JAVA_OPTS -jar $executable $ags
|
java $JAVA_OPTS -jar $executable $ags
|
||||||
|
@ -1,31 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
SCRIPT="$0"
|
|
||||||
|
|
||||||
while [ -h "$SCRIPT" ] ; do
|
|
||||||
ls=`ls -ld "$SCRIPT"`
|
|
||||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
|
||||||
if expr "$link" : '/.*' > /dev/null; then
|
|
||||||
SCRIPT="$link"
|
|
||||||
else
|
|
||||||
SCRIPT=`dirname "$SCRIPT"`/"$link"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ ! -d "${APP_DIR}" ]; then
|
|
||||||
APP_DIR=`dirname "$SCRIPT"`/..
|
|
||||||
APP_DIR=`cd "${APP_DIR}"; pwd`
|
|
||||||
fi
|
|
||||||
|
|
||||||
executable="./modules/swagger-codegen-cli/target/swagger-codegen-cli.jar"
|
|
||||||
|
|
||||||
if [ ! -f "$executable" ]
|
|
||||||
then
|
|
||||||
mvn clean package
|
|
||||||
fi
|
|
||||||
|
|
||||||
# if you've executed sbt assembly previously it will use that instead.
|
|
||||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
|
||||||
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/wordnik.json -l java -o samples/client/wordnik/java"
|
|
||||||
|
|
||||||
java $JAVA_OPTS -jar $executable $ags
|
|
@ -26,6 +26,6 @@ fi
|
|||||||
|
|
||||||
# if you've executed sbt assembly previously it will use that instead.
|
# if you've executed sbt assembly previously it will use that instead.
|
||||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l javascript-closure-angular -o samples/client/petstore/javascript-closure-angular"
|
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l javascript-closure-angular -o samples/client/petstore/javascript-closure-angular"
|
||||||
|
|
||||||
java $JAVA_OPTS -jar $executable $ags
|
java $JAVA_OPTS -jar $executable $ags
|
||||||
|
@ -1,31 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
SCRIPT="$0"
|
|
||||||
|
|
||||||
while [ -h "$SCRIPT" ] ; do
|
|
||||||
ls=`ls -ld "$SCRIPT"`
|
|
||||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
|
||||||
if expr "$link" : '/.*' > /dev/null; then
|
|
||||||
SCRIPT="$link"
|
|
||||||
else
|
|
||||||
SCRIPT=`dirname "$SCRIPT"`/"$link"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ ! -d "${APP_DIR}" ]; then
|
|
||||||
APP_DIR=`dirname "$SCRIPT"`/..
|
|
||||||
APP_DIR=`cd "${APP_DIR}"; pwd`
|
|
||||||
fi
|
|
||||||
|
|
||||||
executable="./modules/swagger-codegen-cli/target/swagger-codegen-cli.jar"
|
|
||||||
|
|
||||||
if [ ! -f "$executable" ]
|
|
||||||
then
|
|
||||||
mvn clean package
|
|
||||||
fi
|
|
||||||
|
|
||||||
# if you've executed sbt assembly previously it will use that instead.
|
|
||||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
|
||||||
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/wordnik.json -l objc -o samples/client/wordnik/objc"
|
|
||||||
|
|
||||||
java $JAVA_OPTS -jar $executable $ags
|
|
@ -27,7 +27,7 @@ fi
|
|||||||
# if you've executed sbt assembly previously it will use that instead.
|
# if you've executed sbt assembly previously it will use that instead.
|
||||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
# complex module name used for testing
|
# complex module name used for testing
|
||||||
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l perl -o samples/client/petstore/perl"
|
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l perl -o samples/client/petstore/perl"
|
||||||
|
|
||||||
java $JAVA_OPTS -jar $executable $ags
|
java $JAVA_OPTS -jar $executable $ags
|
||||||
|
|
||||||
|
@ -26,6 +26,6 @@ fi
|
|||||||
|
|
||||||
# if you've executed sbt assembly previously it will use that instead.
|
# if you've executed sbt assembly previously it will use that instead.
|
||||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
ags="$@ generate -t modules/swagger-codegen/src/main/resources/php -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l php -o samples/client/petstore/php"
|
ags="$@ generate -t modules/swagger-codegen/src/main/resources/php -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l php -o samples/client/petstore/php"
|
||||||
|
|
||||||
java $JAVA_OPTS -jar $executable $ags
|
java $JAVA_OPTS -jar $executable $ags
|
||||||
|
@ -26,6 +26,6 @@ fi
|
|||||||
|
|
||||||
# if you've executed sbt assembly previously it will use that instead.
|
# if you've executed sbt assembly previously it will use that instead.
|
||||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
ags="$@ generate -t modules/swagger-codegen/src/main/resources/python -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l python -o samples/client/petstore/python"
|
ags="$@ generate -t modules/swagger-codegen/src/main/resources/python -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l python -o samples/client/petstore/python"
|
||||||
|
|
||||||
java $JAVA_OPTS -jar $executable $ags
|
java $JAVA_OPTS -jar $executable $ags
|
||||||
|
@ -26,6 +26,6 @@ fi
|
|||||||
|
|
||||||
# if you've executed sbt assembly previously it will use that instead.
|
# if you've executed sbt assembly previously it will use that instead.
|
||||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
ags="$@ generate -t modules/swagger-codegen/src/main/resources/qt5cpp -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l qt5cpp -o samples/client/petstore/qt5cpp"
|
ags="$@ generate -t modules/swagger-codegen/src/main/resources/qt5cpp -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l qt5cpp -o samples/client/petstore/qt5cpp"
|
||||||
|
|
||||||
java $JAVA_OPTS -jar $executable $ags
|
java $JAVA_OPTS -jar $executable $ags
|
||||||
|
@ -26,6 +26,6 @@ fi
|
|||||||
|
|
||||||
# if you've executed sbt assembly previously it will use that instead.
|
# if you've executed sbt assembly previously it will use that instead.
|
||||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
ags="$@ generate -t modules/swagger-codegen/src/main/resources/ruby -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l ruby -c bin/ruby-petstore.json -o samples/client/petstore/ruby"
|
ags="$@ generate -t modules/swagger-codegen/src/main/resources/ruby -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l ruby -c bin/ruby-petstore.json -o samples/client/petstore/ruby"
|
||||||
|
|
||||||
java $JAVA_OPTS -jar $executable $ags
|
java $JAVA_OPTS -jar $executable $ags
|
||||||
|
@ -26,6 +26,6 @@ fi
|
|||||||
|
|
||||||
# if you've executed sbt assembly previously it will use that instead.
|
# if you've executed sbt assembly previously it will use that instead.
|
||||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
ags="$@ generate -t modules/swagger-codegen/src/main/resources/asyncscala -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l async-scala -o samples/client/petstore/async-scala"
|
ags="$@ generate -t modules/swagger-codegen/src/main/resources/asyncscala -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l async-scala -o samples/client/petstore/async-scala"
|
||||||
|
|
||||||
java $JAVA_OPTS -jar $executable $ags
|
java $JAVA_OPTS -jar $executable $ags
|
||||||
|
@ -26,6 +26,6 @@ fi
|
|||||||
|
|
||||||
# if you've executed sbt assembly previously it will use that instead.
|
# if you've executed sbt assembly previously it will use that instead.
|
||||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
ags="$@ generate -t modules/swagger-codegen/src/main/resources/scala -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l scala -o samples/client/petstore/scala"
|
ags="$@ generate -t modules/swagger-codegen/src/main/resources/scala -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l scala -o samples/client/petstore/scala"
|
||||||
|
|
||||||
java $JAVA_OPTS -jar $executable $ags
|
java $JAVA_OPTS -jar $executable $ags
|
||||||
|
@ -1,31 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
SCRIPT="$0"
|
|
||||||
|
|
||||||
while [ -h "$SCRIPT" ] ; do
|
|
||||||
ls=`ls -ld "$SCRIPT"`
|
|
||||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
|
||||||
if expr "$link" : '/.*' > /dev/null; then
|
|
||||||
SCRIPT="$link"
|
|
||||||
else
|
|
||||||
SCRIPT=`dirname "$SCRIPT"`/"$link"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ ! -d "${APP_DIR}" ]; then
|
|
||||||
APP_DIR=`dirname "$SCRIPT"`/..
|
|
||||||
APP_DIR=`cd "${APP_DIR}"; pwd`
|
|
||||||
fi
|
|
||||||
|
|
||||||
executable="./modules/swagger-codegen-cli/target/swagger-codegen-cli.jar"
|
|
||||||
|
|
||||||
if [ ! -f "$executable" ]
|
|
||||||
then
|
|
||||||
mvn clean package
|
|
||||||
fi
|
|
||||||
|
|
||||||
# if you've executed sbt assembly previously it will use that instead.
|
|
||||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
|
||||||
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/wordnik.json -l scala -o samples/client/wordnik/scala"
|
|
||||||
|
|
||||||
java $JAVA_OPTS -jar $executable $ags
|
|
@ -26,6 +26,6 @@ fi
|
|||||||
|
|
||||||
# if you've executed sbt assembly previously it will use that instead.
|
# if you've executed sbt assembly previously it will use that instead.
|
||||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
ags="$@ generate -t modules/swagger-codegen/src/main/resources/scalatra -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l scalatra -o samples/server/petstore/scalatra"
|
ags="$@ generate -t modules/swagger-codegen/src/main/resources/scalatra -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l scalatra -o samples/server/petstore/scalatra"
|
||||||
|
|
||||||
java $JAVA_OPTS -jar $executable $ags
|
java $JAVA_OPTS -jar $executable $ags
|
||||||
|
@ -26,6 +26,6 @@ fi
|
|||||||
|
|
||||||
# if you've executed sbt assembly previously it will use that instead.
|
# if you've executed sbt assembly previously it will use that instead.
|
||||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
ags="$@ generate -t modules/swagger-codegen/src/main/resources/silex -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l silex-PHP -o samples/server/petstore/silex"
|
ags="$@ generate -t modules/swagger-codegen/src/main/resources/silex -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l silex-PHP -o samples/server/petstore/silex"
|
||||||
|
|
||||||
java $JAVA_OPTS -jar $executable $ags
|
java $JAVA_OPTS -jar $executable $ags
|
||||||
|
@ -26,6 +26,6 @@ fi
|
|||||||
|
|
||||||
# if you've executed sbt assembly previously it will use that instead.
|
# if you've executed sbt assembly previously it will use that instead.
|
||||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
ags="$@ generate -t modules/swagger-codegen/src/main/resources/slim -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l slim -o samples/server/petstore/slim"
|
ags="$@ generate -t modules/swagger-codegen/src/main/resources/slim -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l slim -o samples/server/petstore/slim"
|
||||||
|
|
||||||
java $JAVA_OPTS -jar $executable $ags
|
java $JAVA_OPTS -jar $executable $ags
|
||||||
|
@ -26,6 +26,6 @@ fi
|
|||||||
|
|
||||||
# if you've executed sbt assembly previously it will use that instead.
|
# if you've executed sbt assembly previously it will use that instead.
|
||||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
ags="$@ generate -t modules/swagger-codegen/src/main/resources/JavaSpringMVC -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l spring-mvc -o samples/server/petstore/spring-mvc-j8-async -c bin/spring-mvc-petstore-j8-async.json"
|
ags="$@ generate -t modules/swagger-codegen/src/main/resources/JavaSpringMVC -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l spring-mvc -o samples/server/petstore/spring-mvc-j8-async -c bin/spring-mvc-petstore-j8-async.json"
|
||||||
|
|
||||||
java $JAVA_OPTS -jar $executable $ags
|
java $JAVA_OPTS -jar $executable $ags
|
||||||
|
@ -26,6 +26,6 @@ fi
|
|||||||
|
|
||||||
# if you've executed sbt assembly previously it will use that instead.
|
# if you've executed sbt assembly previously it will use that instead.
|
||||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
ags="$@ generate -t modules/swagger-codegen/src/main/resources/JavaSpringMVC -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l spring-mvc -o samples/server/petstore/spring-mvc"
|
ags="$@ generate -t modules/swagger-codegen/src/main/resources/JavaSpringMVC -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l spring-mvc -o samples/server/petstore/spring-mvc"
|
||||||
|
|
||||||
java $JAVA_OPTS -jar $executable $ags
|
java $JAVA_OPTS -jar $executable $ags
|
||||||
|
@ -26,6 +26,6 @@ fi
|
|||||||
|
|
||||||
# if you've executed sbt assembly previously it will use that instead.
|
# if you've executed sbt assembly previously it will use that instead.
|
||||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
ags="$@ generate -t modules/swagger-codegen/src/main/resources/tizen -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l tizen -o samples/client/petstore/tizen"
|
ags="$@ generate -t modules/swagger-codegen/src/main/resources/tizen -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l tizen -o samples/client/petstore/tizen"
|
||||||
|
|
||||||
java $JAVA_OPTS -jar $executable $ags
|
java $JAVA_OPTS -jar $executable $ags
|
||||||
|
@ -115,6 +115,14 @@
|
|||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<source>1.7</source>
|
||||||
|
<target>1.7</target>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
<profiles>
|
<profiles>
|
||||||
|
@ -9,7 +9,7 @@ public class CodegenParameter {
|
|||||||
public Boolean isFormParam, isQueryParam, isPathParam, isHeaderParam,
|
public Boolean isFormParam, isQueryParam, isPathParam, isHeaderParam,
|
||||||
isCookieParam, isBodyParam, hasMore, isContainer,
|
isCookieParam, isBodyParam, hasMore, isContainer,
|
||||||
secondaryParam, isCollectionFormatMulti, isPrimitiveType;
|
secondaryParam, isCollectionFormatMulti, isPrimitiveType;
|
||||||
public String baseName, paramName, dataType, datatypeWithEnum, collectionFormat, description, baseType, defaultValue;
|
public String baseName, paramName, dataType, datatypeWithEnum, collectionFormat, description, unescapedDescription, baseType, defaultValue;
|
||||||
public String example; // example value (x-example)
|
public String example; // example value (x-example)
|
||||||
public String jsonSchema;
|
public String jsonSchema;
|
||||||
public Boolean isString, isInteger, isLong, isFloat, isDouble, isByteArray, isBinary, isBoolean, isDate, isDateTime;
|
public Boolean isString, isInteger, isLong, isFloat, isDouble, isByteArray, isBinary, isBoolean, isDate, isDateTime;
|
||||||
|
@ -1125,6 +1125,24 @@ public class DefaultCodegen {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (p instanceof BaseIntegerProperty) {
|
||||||
|
BaseIntegerProperty sp = (BaseIntegerProperty) p;
|
||||||
|
property.isInteger = true;
|
||||||
|
/*if (sp.getEnum() != null) {
|
||||||
|
List<Integer> _enum = sp.getEnum();
|
||||||
|
property._enum = new ArrayList<String>();
|
||||||
|
for(Integer i : _enum) {
|
||||||
|
property._enum.add(i.toString());
|
||||||
|
}
|
||||||
|
property.isEnum = true;
|
||||||
|
|
||||||
|
// legacy support
|
||||||
|
Map<String, Object> allowableValues = new HashMap<String, Object>();
|
||||||
|
allowableValues.put("values", _enum);
|
||||||
|
property.allowableValues = allowableValues;
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
|
||||||
if (p instanceof IntegerProperty) {
|
if (p instanceof IntegerProperty) {
|
||||||
IntegerProperty sp = (IntegerProperty) p;
|
IntegerProperty sp = (IntegerProperty) p;
|
||||||
property.isInteger = true;
|
property.isInteger = true;
|
||||||
@ -1173,6 +1191,24 @@ public class DefaultCodegen {
|
|||||||
property.isByteArray = true;
|
property.isByteArray = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (p instanceof DecimalProperty) {
|
||||||
|
DecimalProperty sp = (DecimalProperty) p;
|
||||||
|
property.isFloat = true;
|
||||||
|
/*if (sp.getEnum() != null) {
|
||||||
|
List<Double> _enum = sp.getEnum();
|
||||||
|
property._enum = new ArrayList<String>();
|
||||||
|
for(Double i : _enum) {
|
||||||
|
property._enum.add(i.toString());
|
||||||
|
}
|
||||||
|
property.isEnum = true;
|
||||||
|
|
||||||
|
// legacy support
|
||||||
|
Map<String, Object> allowableValues = new HashMap<String, Object>();
|
||||||
|
allowableValues.put("values", _enum);
|
||||||
|
property.allowableValues = allowableValues;
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
|
||||||
if (p instanceof DoubleProperty) {
|
if (p instanceof DoubleProperty) {
|
||||||
DoubleProperty sp = (DoubleProperty) p;
|
DoubleProperty sp = (DoubleProperty) p;
|
||||||
property.isDouble = true;
|
property.isDouble = true;
|
||||||
@ -1542,33 +1578,20 @@ public class DefaultCodegen {
|
|||||||
|
|
||||||
|
|
||||||
allParams.add(p);
|
allParams.add(p);
|
||||||
|
// Issue #2561 (neilotoole) : Moved setting of is<Type>Param flags
|
||||||
|
// from here to fromParameter().
|
||||||
if (param instanceof QueryParameter) {
|
if (param instanceof QueryParameter) {
|
||||||
p.isQueryParam = new Boolean(true);
|
|
||||||
queryParams.add(p.copy());
|
queryParams.add(p.copy());
|
||||||
} else if (param instanceof PathParameter) {
|
} else if (param instanceof PathParameter) {
|
||||||
p.required = true;
|
|
||||||
p.isPathParam = new Boolean(true);
|
|
||||||
pathParams.add(p.copy());
|
pathParams.add(p.copy());
|
||||||
} else if (param instanceof HeaderParameter) {
|
} else if (param instanceof HeaderParameter) {
|
||||||
p.isHeaderParam = new Boolean(true);
|
|
||||||
headerParams.add(p.copy());
|
headerParams.add(p.copy());
|
||||||
} else if (param instanceof CookieParameter) {
|
} else if (param instanceof CookieParameter) {
|
||||||
p.isCookieParam = new Boolean(true);
|
|
||||||
cookieParams.add(p.copy());
|
cookieParams.add(p.copy());
|
||||||
} else if (param instanceof BodyParameter) {
|
} else if (param instanceof BodyParameter) {
|
||||||
p.isBodyParam = new Boolean(true);
|
|
||||||
p.isBinary = p.dataType.toLowerCase().startsWith("byte");
|
|
||||||
bodyParam = p;
|
bodyParam = p;
|
||||||
bodyParams.add(p.copy());
|
bodyParams.add(p.copy());
|
||||||
} else if (param instanceof FormParameter) {
|
} else if (param instanceof FormParameter) {
|
||||||
if ("file".equalsIgnoreCase(((FormParameter) param).getType())) {
|
|
||||||
p.isFile = true;
|
|
||||||
} else if("file".equals(p.baseType)){
|
|
||||||
p.isFile = true;
|
|
||||||
} else {
|
|
||||||
p.notFile = true;
|
|
||||||
}
|
|
||||||
p.isFormParam = new Boolean(true);
|
|
||||||
formParams.add(p.copy());
|
formParams.add(p.copy());
|
||||||
}
|
}
|
||||||
if (p.required == null || !p.required) {
|
if (p.required == null || !p.required) {
|
||||||
@ -1683,6 +1706,7 @@ public class DefaultCodegen {
|
|||||||
CodegenParameter p = CodegenModelFactory.newInstance(CodegenModelType.PARAMETER);
|
CodegenParameter p = CodegenModelFactory.newInstance(CodegenModelType.PARAMETER);
|
||||||
p.baseName = param.getName();
|
p.baseName = param.getName();
|
||||||
p.description = escapeText(param.getDescription());
|
p.description = escapeText(param.getDescription());
|
||||||
|
p.unescapedDescription = param.getDescription();
|
||||||
if (param.getRequired()) {
|
if (param.getRequired()) {
|
||||||
p.required = param.getRequired();
|
p.required = param.getRequired();
|
||||||
}
|
}
|
||||||
@ -1896,6 +1920,33 @@ public class DefaultCodegen {
|
|||||||
// should be overridden by lang codegen
|
// should be overridden by lang codegen
|
||||||
setParameterExampleValue(p);
|
setParameterExampleValue(p);
|
||||||
|
|
||||||
|
// Issue #2561 (neilotoole) : Set the is<TYPE>Param flags.
|
||||||
|
// This code has been moved to here from #fromOperation
|
||||||
|
// because these values should be set before calling #postProcessParameter.
|
||||||
|
// See: https://github.com/swagger-api/swagger-codegen/issues/2561
|
||||||
|
if (param instanceof QueryParameter) {
|
||||||
|
p.isQueryParam = true;
|
||||||
|
} else if (param instanceof PathParameter) {
|
||||||
|
p.required = true;
|
||||||
|
p.isPathParam = true;
|
||||||
|
} else if (param instanceof HeaderParameter) {
|
||||||
|
p.isHeaderParam = true;
|
||||||
|
} else if (param instanceof CookieParameter) {
|
||||||
|
p.isCookieParam = true;
|
||||||
|
} else if (param instanceof BodyParameter) {
|
||||||
|
p.isBodyParam = true;
|
||||||
|
p.isBinary = p.dataType.toLowerCase().startsWith("byte");
|
||||||
|
} else if (param instanceof FormParameter) {
|
||||||
|
if ("file".equalsIgnoreCase(((FormParameter) param).getType())) {
|
||||||
|
p.isFile = true;
|
||||||
|
} else if("file".equals(p.baseType)){
|
||||||
|
p.isFile = true;
|
||||||
|
} else {
|
||||||
|
p.notFile = true;
|
||||||
|
}
|
||||||
|
p.isFormParam = true;
|
||||||
|
}
|
||||||
|
|
||||||
postProcessParameter(p);
|
postProcessParameter(p);
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
@ -89,7 +89,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
|||||||
"Int64",
|
"Int64",
|
||||||
"Float",
|
"Float",
|
||||||
"Guid",
|
"Guid",
|
||||||
"Stream", // not really a primitive, we include it to avoid model import
|
"System.IO.Stream", // not really a primitive, we include it to avoid model import
|
||||||
"Object")
|
"Object")
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -110,7 +110,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
|||||||
typeMapping.put("number", "double?");
|
typeMapping.put("number", "double?");
|
||||||
typeMapping.put("datetime", "DateTime?");
|
typeMapping.put("datetime", "DateTime?");
|
||||||
typeMapping.put("date", "DateTime?");
|
typeMapping.put("date", "DateTime?");
|
||||||
typeMapping.put("file", "Stream");
|
typeMapping.put("file", "System.IO.Stream");
|
||||||
typeMapping.put("array", "List");
|
typeMapping.put("array", "List");
|
||||||
typeMapping.put("list", "List");
|
typeMapping.put("list", "List");
|
||||||
typeMapping.put("map", "Dictionary");
|
typeMapping.put("map", "Dictionary");
|
||||||
|
@ -59,6 +59,7 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp
|
|||||||
//TODO binary should be mapped to byte array
|
//TODO binary should be mapped to byte array
|
||||||
// mapped to String as a workaround
|
// mapped to String as a workaround
|
||||||
typeMapping.put("binary", "string");
|
typeMapping.put("binary", "string");
|
||||||
|
typeMapping.put("ByteArray", "string");
|
||||||
|
|
||||||
cliOptions.add(new CliOption(CodegenConstants.MODEL_PROPERTY_NAMING, CodegenConstants.MODEL_PROPERTY_NAMING_DESC).defaultValue("camelCase"));
|
cliOptions.add(new CliOption(CodegenConstants.MODEL_PROPERTY_NAMING, CodegenConstants.MODEL_PROPERTY_NAMING_DESC).defaultValue("camelCase"));
|
||||||
|
|
||||||
|
@ -168,7 +168,7 @@ public class AkkaScalaClientCodegen extends DefaultCodegen implements CodegenCon
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getHelp() {
|
public String getHelp() {
|
||||||
return "Generates a Scala client library base on Akka/Spray.";
|
return "Generates a Scala client library (beta) base on Akka/Spray.";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -11,6 +11,7 @@ import io.swagger.codegen.SupportingFile;
|
|||||||
import io.swagger.codegen.CodegenProperty;
|
import io.swagger.codegen.CodegenProperty;
|
||||||
import io.swagger.codegen.CodegenModel;
|
import io.swagger.codegen.CodegenModel;
|
||||||
import io.swagger.codegen.CodegenOperation;
|
import io.swagger.codegen.CodegenOperation;
|
||||||
|
import io.swagger.codegen.CodegenParameter;
|
||||||
import io.swagger.models.properties.*;
|
import io.swagger.models.properties.*;
|
||||||
import io.swagger.codegen.CliOption;
|
import io.swagger.codegen.CliOption;
|
||||||
import io.swagger.models.Model;
|
import io.swagger.models.Model;
|
||||||
@ -34,6 +35,7 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
|
|||||||
private static final Logger LOGGER = LoggerFactory.getLogger(CSharpClientCodegen.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(CSharpClientCodegen.class);
|
||||||
private static final String NET45 = "v4.5";
|
private static final String NET45 = "v4.5";
|
||||||
private static final String NET35 = "v3.5";
|
private static final String NET35 = "v3.5";
|
||||||
|
private static final String UWP = "uwp";
|
||||||
private static final String DATA_TYPE_WITH_ENUM_EXTENSION = "plainDatatypeWithEnum";
|
private static final String DATA_TYPE_WITH_ENUM_EXTENSION = "plainDatatypeWithEnum";
|
||||||
|
|
||||||
protected String packageGuid = "{" + java.util.UUID.randomUUID().toString().toUpperCase() + "}";
|
protected String packageGuid = "{" + java.util.UUID.randomUUID().toString().toUpperCase() + "}";
|
||||||
@ -44,10 +46,13 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
|
|||||||
protected String packageCopyright = "No Copyright";
|
protected String packageCopyright = "No Copyright";
|
||||||
protected String clientPackage = "IO.Swagger.Client";
|
protected String clientPackage = "IO.Swagger.Client";
|
||||||
protected String localVariablePrefix = "";
|
protected String localVariablePrefix = "";
|
||||||
|
protected String apiDocPath = "docs/";
|
||||||
|
protected String modelDocPath = "docs/";
|
||||||
|
|
||||||
protected String targetFramework = NET45;
|
protected String targetFramework = NET45;
|
||||||
protected String targetFrameworkNuget = "net45";
|
protected String targetFrameworkNuget = "net45";
|
||||||
protected boolean supportsAsync = Boolean.TRUE;
|
protected boolean supportsAsync = Boolean.TRUE;
|
||||||
|
protected boolean supportsUWP = Boolean.FALSE;
|
||||||
|
|
||||||
|
|
||||||
protected final Map<String, String> frameworks;
|
protected final Map<String, String> frameworks;
|
||||||
@ -60,6 +65,9 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
|
|||||||
modelTestTemplateFiles.put("model_test.mustache", ".cs");
|
modelTestTemplateFiles.put("model_test.mustache", ".cs");
|
||||||
apiTestTemplateFiles.put("api_test.mustache", ".cs");
|
apiTestTemplateFiles.put("api_test.mustache", ".cs");
|
||||||
|
|
||||||
|
modelDocTemplateFiles.put("model_doc.mustache", ".md");
|
||||||
|
apiDocTemplateFiles.put("api_doc.mustache", ".md");
|
||||||
|
|
||||||
// C# client default
|
// C# client default
|
||||||
setSourceFolder("src" + File.separator + "main" + File.separator + "csharp");
|
setSourceFolder("src" + File.separator + "main" + File.separator + "csharp");
|
||||||
|
|
||||||
@ -89,6 +97,7 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
|
|||||||
frameworks = new ImmutableMap.Builder<String, String>()
|
frameworks = new ImmutableMap.Builder<String, String>()
|
||||||
.put(NET35, ".NET Framework 3.5 compatible")
|
.put(NET35, ".NET Framework 3.5 compatible")
|
||||||
.put(NET45, ".NET Framework 4.5+ compatible")
|
.put(NET45, ".NET Framework 4.5+ compatible")
|
||||||
|
.put(UWP, "Universal Windows Platform - beta support")
|
||||||
.build();
|
.build();
|
||||||
framework.defaultValue(this.targetFramework);
|
framework.defaultValue(this.targetFramework);
|
||||||
framework.setEnum(frameworks);
|
framework.setEnum(frameworks);
|
||||||
@ -156,6 +165,13 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
|
|||||||
if(additionalProperties.containsKey("supportsAsync")){
|
if(additionalProperties.containsKey("supportsAsync")){
|
||||||
additionalProperties.remove("supportsAsync");
|
additionalProperties.remove("supportsAsync");
|
||||||
}
|
}
|
||||||
|
} else if (UWP.equals(this.targetFramework)){
|
||||||
|
setTargetFrameworkNuget("uwp");
|
||||||
|
setSupportsAsync(Boolean.TRUE);
|
||||||
|
setSupportsUWP(Boolean.TRUE);
|
||||||
|
additionalProperties.put("supportsAsync", this.supportsUWP);
|
||||||
|
additionalProperties.put("supportsUWP", this.supportsAsync);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
setTargetFrameworkNuget("net45");
|
setTargetFrameworkNuget("net45");
|
||||||
setSupportsAsync(Boolean.TRUE);
|
setSupportsAsync(Boolean.TRUE);
|
||||||
@ -209,17 +225,19 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
|
|||||||
supportingFiles.add(new SupportingFile("compile.mustache", "", "compile.bat"));
|
supportingFiles.add(new SupportingFile("compile.mustache", "", "compile.bat"));
|
||||||
supportingFiles.add(new SupportingFile("compile-mono.sh.mustache", "", "compile-mono.sh"));
|
supportingFiles.add(new SupportingFile("compile-mono.sh.mustache", "", "compile-mono.sh"));
|
||||||
supportingFiles.add(new SupportingFile("packages.config.mustache", "vendor" + java.io.File.separator, "packages.config"));
|
supportingFiles.add(new SupportingFile("packages.config.mustache", "vendor" + java.io.File.separator, "packages.config"));
|
||||||
supportingFiles.add(new SupportingFile("README.md", "", "README.md"));
|
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
|
||||||
supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh"));
|
supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh"));
|
||||||
supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore"));
|
supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore"));
|
||||||
|
|
||||||
|
|
||||||
if (optionalAssemblyInfoFlag) {
|
if (optionalAssemblyInfoFlag) {
|
||||||
supportingFiles.add(new SupportingFile("AssemblyInfo.mustache", packageFolder + File.separator + "Properties", "AssemblyInfo.cs"));
|
supportingFiles.add(new SupportingFile("AssemblyInfo.mustache", packageFolder + File.separator + "Properties", "AssemblyInfo.cs"));
|
||||||
}
|
}
|
||||||
if (optionalProjectFileFlag) {
|
if (optionalProjectFileFlag) {
|
||||||
supportingFiles.add(new SupportingFile("Project.mustache", packageFolder, clientPackage + ".csproj"));
|
supportingFiles.add(new SupportingFile("Project.mustache", packageFolder, clientPackage + ".csproj"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
additionalProperties.put("apiDocPath", apiDocPath);
|
||||||
|
additionalProperties.put("modelDocPath", modelDocPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -290,20 +308,20 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> postProcessModels(Map<String, Object> objMap) {
|
public Map<String, Object> postProcessModels(Map<String, Object> objMap) {
|
||||||
Map<String, Object> objs = super.postProcessModels(objMap);
|
Map<String, Object> objs = super.postProcessModels(objMap);
|
||||||
|
|
||||||
List<Object> models = (List<Object>) objs.get("models");
|
List<Object> models = (List<Object>) objs.get("models");
|
||||||
for (Object _mo : models) {
|
for (Object _mo : models) {
|
||||||
Map<String, Object> mo = (Map<String, Object>) _mo;
|
Map<String, Object> mo = (Map<String, Object>) _mo;
|
||||||
CodegenModel cm = (CodegenModel) mo.get("model");
|
CodegenModel cm = (CodegenModel) mo.get("model");
|
||||||
for (CodegenProperty var : cm.vars) {
|
for (CodegenProperty var : cm.vars) {
|
||||||
Map<String, Object> allowableValues = var.allowableValues;
|
Map<String, Object> allowableValues = var.allowableValues;
|
||||||
|
|
||||||
// handle ArrayProperty
|
// handle ArrayProperty
|
||||||
if (var.items != null) {
|
if (var.items != null) {
|
||||||
allowableValues = var.items.allowableValues;
|
allowableValues = var.items.allowableValues;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (allowableValues == null) {
|
if (allowableValues == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -339,12 +357,12 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
|
|||||||
if (var.datatypeWithEnum != null) {
|
if (var.datatypeWithEnum != null) {
|
||||||
var.vendorExtensions.put(DATA_TYPE_WITH_ENUM_EXTENSION, var.datatypeWithEnum.substring(0, var.datatypeWithEnum.length() - 1));
|
var.vendorExtensions.put(DATA_TYPE_WITH_ENUM_EXTENSION, var.datatypeWithEnum.substring(0, var.datatypeWithEnum.length() - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (var.defaultValue != null) {
|
if (var.defaultValue != null) {
|
||||||
String enumName = null;
|
String enumName = null;
|
||||||
|
|
||||||
for (Map<String, String> enumVar : enumVars) {
|
for (Map<String, String> enumVar : enumVars) {
|
||||||
|
|
||||||
if (var.defaultValue.replace("\"", "").equals(enumVar.get("value"))) {
|
if (var.defaultValue.replace("\"", "").equals(enumVar.get("value"))) {
|
||||||
enumName = enumVar.get("name");
|
enumName = enumVar.get("name");
|
||||||
break;
|
break;
|
||||||
@ -403,7 +421,7 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(removedChildEnum) {
|
if(removedChildEnum) {
|
||||||
// If we removed an entry from this model's vars, we need to ensure hasMore is updated
|
// If we removed an entry from this model's vars, we need to ensure hasMore is updated
|
||||||
int count = 0, numVars = codegenProperties.size();
|
int count = 0, numVars = codegenProperties.size();
|
||||||
@ -453,4 +471,24 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
|
|||||||
public void setSupportsAsync(Boolean supportsAsync){
|
public void setSupportsAsync(Boolean supportsAsync){
|
||||||
this.supportsAsync = supportsAsync;
|
this.supportsAsync = supportsAsync;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setSupportsUWP(Boolean supportsUWP){
|
||||||
|
this.supportsUWP = supportsUWP;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toModelDocFilename(String name) {
|
||||||
|
return toModelFilename(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String apiDocFileFolder() {
|
||||||
|
return (outputFolder + "/" + apiDocPath).replace('/', File.separatorChar);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String modelDocFileFolder() {
|
||||||
|
return (outputFolder + "/" + modelDocPath).replace('/', File.separatorChar);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ public class CsharpDotNet2ClientCodegen extends DefaultCodegen implements Codege
|
|||||||
"Integer",
|
"Integer",
|
||||||
"Long",
|
"Long",
|
||||||
"Float",
|
"Float",
|
||||||
"Stream", // not really a primitive, we include it to avoid model import
|
"System.IO.Stream", // not really a primitive, we include it to avoid model import
|
||||||
"Object")
|
"Object")
|
||||||
);
|
);
|
||||||
instantiationTypes.put("array", "List");
|
instantiationTypes.put("array", "List");
|
||||||
@ -76,7 +76,7 @@ public class CsharpDotNet2ClientCodegen extends DefaultCodegen implements Codege
|
|||||||
typeMapping.put("number", "double?");
|
typeMapping.put("number", "double?");
|
||||||
typeMapping.put("datetime", "DateTime?");
|
typeMapping.put("datetime", "DateTime?");
|
||||||
typeMapping.put("date", "DateTime?");
|
typeMapping.put("date", "DateTime?");
|
||||||
typeMapping.put("file", "Stream");
|
typeMapping.put("file", "System.IO.Stream");
|
||||||
typeMapping.put("array", "List");
|
typeMapping.put("array", "List");
|
||||||
typeMapping.put("list", "List");
|
typeMapping.put("list", "List");
|
||||||
typeMapping.put("map", "Dictionary");
|
typeMapping.put("map", "Dictionary");
|
||||||
|
@ -25,6 +25,7 @@ public class FlaskConnexionCodegen extends DefaultCodegen implements CodegenConf
|
|||||||
|
|
||||||
public static final String CONTROLLER_PACKAGE = "controllerPackage";
|
public static final String CONTROLLER_PACKAGE = "controllerPackage";
|
||||||
public static final String DEFAULT_CONTROLLER = "defaultController";
|
public static final String DEFAULT_CONTROLLER = "defaultController";
|
||||||
|
public static final String SUPPORT_PYTHON2= "supportPython2";
|
||||||
|
|
||||||
protected String apiVersion = "1.0.0";
|
protected String apiVersion = "1.0.0";
|
||||||
protected int serverPort = 8080;
|
protected int serverPort = 8080;
|
||||||
@ -105,11 +106,17 @@ public class FlaskConnexionCodegen extends DefaultCodegen implements CodegenConf
|
|||||||
"",
|
"",
|
||||||
"README.md")
|
"README.md")
|
||||||
);
|
);
|
||||||
|
supportingFiles.add(new SupportingFile("__init__.mustache",
|
||||||
|
"",
|
||||||
|
"__init__.py")
|
||||||
|
);
|
||||||
|
|
||||||
cliOptions.add(new CliOption(CONTROLLER_PACKAGE, "controller package").
|
cliOptions.add(new CliOption(CONTROLLER_PACKAGE, "controller package").
|
||||||
defaultValue("controllers"));
|
defaultValue("controllers"));
|
||||||
cliOptions.add(new CliOption(DEFAULT_CONTROLLER, "default controller").
|
cliOptions.add(new CliOption(DEFAULT_CONTROLLER, "default controller").
|
||||||
defaultValue("default_controller"));
|
defaultValue("default_controller"));
|
||||||
|
cliOptions.add(new CliOption(SUPPORT_PYTHON2, "support python2").
|
||||||
|
defaultValue("false"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -124,6 +131,7 @@ public class FlaskConnexionCodegen extends DefaultCodegen implements CodegenConf
|
|||||||
this.controllerPackage = "controllers";
|
this.controllerPackage = "controllers";
|
||||||
additionalProperties.put(CONTROLLER_PACKAGE, this.controllerPackage);
|
additionalProperties.put(CONTROLLER_PACKAGE, this.controllerPackage);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (additionalProperties.containsKey(DEFAULT_CONTROLLER)) {
|
if (additionalProperties.containsKey(DEFAULT_CONTROLLER)) {
|
||||||
this.defaultController = additionalProperties.get(DEFAULT_CONTROLLER).toString();
|
this.defaultController = additionalProperties.get(DEFAULT_CONTROLLER).toString();
|
||||||
}
|
}
|
||||||
@ -132,11 +140,19 @@ public class FlaskConnexionCodegen extends DefaultCodegen implements CodegenConf
|
|||||||
additionalProperties.put(DEFAULT_CONTROLLER, this.defaultController);
|
additionalProperties.put(DEFAULT_CONTROLLER, this.defaultController);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Boolean.TRUE.equals(additionalProperties.get(SUPPORT_PYTHON2))) {
|
||||||
|
additionalProperties.put(SUPPORT_PYTHON2, Boolean.TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
if(!new java.io.File(controllerPackage + File.separator + defaultController + ".py").exists()) {
|
if(!new java.io.File(controllerPackage + File.separator + defaultController + ".py").exists()) {
|
||||||
supportingFiles.add(new SupportingFile("controller.mustache",
|
supportingFiles.add(new SupportingFile("controller.mustache",
|
||||||
controllerPackage,
|
controllerPackage,
|
||||||
defaultController + ".py")
|
defaultController + ".py")
|
||||||
);
|
);
|
||||||
|
supportingFiles.add(new SupportingFile("__init__.mustache",
|
||||||
|
controllerPackage,
|
||||||
|
"__init__.py")
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ import io.swagger.codegen.*;
|
|||||||
import io.swagger.models.properties.ArrayProperty;
|
import io.swagger.models.properties.ArrayProperty;
|
||||||
import io.swagger.models.properties.MapProperty;
|
import io.swagger.models.properties.MapProperty;
|
||||||
import io.swagger.models.properties.Property;
|
import io.swagger.models.properties.Property;
|
||||||
|
import io.swagger.models.parameters.Parameter;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@ -18,6 +19,8 @@ public class GoClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
|
|
||||||
protected String packageName = "swagger";
|
protected String packageName = "swagger";
|
||||||
protected String packageVersion = "1.0.0";
|
protected String packageVersion = "1.0.0";
|
||||||
|
protected String apiDocPath = "docs/";
|
||||||
|
protected String modelDocPath = "docs/";
|
||||||
|
|
||||||
public CodegenType getTag() {
|
public CodegenType getTag() {
|
||||||
return CodegenType.CLIENT;
|
return CodegenType.CLIENT;
|
||||||
@ -36,6 +39,10 @@ public class GoClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
outputFolder = "generated-code/go";
|
outputFolder = "generated-code/go";
|
||||||
modelTemplateFiles.put("model.mustache", ".go");
|
modelTemplateFiles.put("model.mustache", ".go");
|
||||||
apiTemplateFiles.put("api.mustache", ".go");
|
apiTemplateFiles.put("api.mustache", ".go");
|
||||||
|
|
||||||
|
modelDocTemplateFiles.put("model_doc.mustache", ".md");
|
||||||
|
apiDocTemplateFiles.put("api_doc.mustache", ".md");
|
||||||
|
|
||||||
templateDir = "go";
|
templateDir = "go";
|
||||||
|
|
||||||
setReservedWordsLowerCase(
|
setReservedWordsLowerCase(
|
||||||
@ -79,11 +86,12 @@ public class GoClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
typeMapping.clear();
|
typeMapping.clear();
|
||||||
typeMapping.put("integer", "int32");
|
typeMapping.put("integer", "int32");
|
||||||
typeMapping.put("long", "int64");
|
typeMapping.put("long", "int64");
|
||||||
|
typeMapping.put("number", "float32");
|
||||||
typeMapping.put("float", "float32");
|
typeMapping.put("float", "float32");
|
||||||
typeMapping.put("double", "float64");
|
typeMapping.put("double", "float64");
|
||||||
typeMapping.put("boolean", "bool");
|
typeMapping.put("boolean", "bool");
|
||||||
typeMapping.put("string", "string");
|
typeMapping.put("string", "string");
|
||||||
typeMapping.put("Date", "time.Time");
|
typeMapping.put("date", "time.Time");
|
||||||
typeMapping.put("DateTime", "time.Time");
|
typeMapping.put("DateTime", "time.Time");
|
||||||
typeMapping.put("password", "string");
|
typeMapping.put("password", "string");
|
||||||
typeMapping.put("File", "*os.File");
|
typeMapping.put("File", "*os.File");
|
||||||
@ -91,6 +99,7 @@ public class GoClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
// map binary to string as a workaround
|
// map binary to string as a workaround
|
||||||
// the correct solution is to use []byte
|
// the correct solution is to use []byte
|
||||||
typeMapping.put("binary", "string");
|
typeMapping.put("binary", "string");
|
||||||
|
typeMapping.put("ByteArray", "string");
|
||||||
|
|
||||||
importMapping = new HashMap<String, String>();
|
importMapping = new HashMap<String, String>();
|
||||||
importMapping.put("time.Time", "time");
|
importMapping.put("time.Time", "time");
|
||||||
@ -101,7 +110,6 @@ public class GoClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
.defaultValue("swagger"));
|
.defaultValue("swagger"));
|
||||||
cliOptions.add(new CliOption(CodegenConstants.PACKAGE_VERSION, "Go package version.")
|
cliOptions.add(new CliOption(CodegenConstants.PACKAGE_VERSION, "Go package version.")
|
||||||
.defaultValue("1.0.0"));
|
.defaultValue("1.0.0"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -124,6 +132,9 @@ public class GoClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
|
|
||||||
additionalProperties.put(CodegenConstants.PACKAGE_NAME, packageName);
|
additionalProperties.put(CodegenConstants.PACKAGE_NAME, packageName);
|
||||||
additionalProperties.put(CodegenConstants.PACKAGE_VERSION, packageVersion);
|
additionalProperties.put(CodegenConstants.PACKAGE_VERSION, packageVersion);
|
||||||
|
|
||||||
|
additionalProperties.put("apiDocPath", apiDocPath);
|
||||||
|
additionalProperties.put("modelDocPath", modelDocPath);
|
||||||
|
|
||||||
modelPackage = packageName;
|
modelPackage = packageName;
|
||||||
apiPackage = packageName;
|
apiPackage = packageName;
|
||||||
@ -131,7 +142,9 @@ public class GoClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
|
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
|
||||||
supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh"));
|
supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh"));
|
||||||
supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore"));
|
supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore"));
|
||||||
supportingFiles.add(new SupportingFile("configuration.mustache", packageName, "Configuration.go"));
|
supportingFiles.add(new SupportingFile("configuration.mustache", "", "configuration.go"));
|
||||||
|
supportingFiles.add(new SupportingFile("api_client.mustache", "", "api_client.go"));
|
||||||
|
supportingFiles.add(new SupportingFile("pom.mustache", "", "pom.xml"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -155,11 +168,11 @@ public class GoClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String apiFileFolder() {
|
public String apiFileFolder() {
|
||||||
return outputFolder + File.separator + packageName;
|
return outputFolder + File.separator;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String modelFileFolder() {
|
public String modelFileFolder() {
|
||||||
return outputFolder + File.separator + packageName;
|
return outputFolder + File.separator;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -195,6 +208,13 @@ public class GoClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toModelName(String name) {
|
public String toModelName(String name) {
|
||||||
|
// camelize the model name
|
||||||
|
// phone_number => PhoneNumber
|
||||||
|
return camelize(toModelFilename(name));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toModelFilename(String name) {
|
||||||
if (!StringUtils.isEmpty(modelNamePrefix)) {
|
if (!StringUtils.isEmpty(modelNamePrefix)) {
|
||||||
name = modelNamePrefix + "_" + name;
|
name = modelNamePrefix + "_" + name;
|
||||||
}
|
}
|
||||||
@ -211,17 +231,68 @@ public class GoClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
name = "model_" + name; // e.g. return => ModelReturn (after camelize)
|
name = "model_" + name; // e.g. return => ModelReturn (after camelize)
|
||||||
}
|
}
|
||||||
|
|
||||||
// camelize the model name
|
return underscore(name);
|
||||||
// phone_number => PhoneNumber
|
|
||||||
return camelize(name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toModelFilename(String name) {
|
public String toApiFilename(String name) {
|
||||||
// should be the same as the model name
|
// replace - with _ e.g. created-at => created_at
|
||||||
|
name = name.replaceAll("-", "_"); // FIXME: a parameter should not be assigned. Also declare the methods parameters as 'final'.
|
||||||
|
|
||||||
|
// e.g. PetApi.go => pet_api.go
|
||||||
|
return underscore(name) + "_api";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Overrides postProcessParameter to add a vendor extension "x-exportParamName".
|
||||||
|
* This is useful when paramName starts with a lowercase letter, but we need that
|
||||||
|
* param to be exportable (starts with an Uppercase letter).
|
||||||
|
*
|
||||||
|
* @param parameter CodegenParameter object to be processed.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void postProcessParameter(CodegenParameter parameter){
|
||||||
|
|
||||||
|
// Give the base class a chance to process
|
||||||
|
super.postProcessParameter(parameter);
|
||||||
|
|
||||||
|
char firstChar = parameter.paramName.charAt(0);
|
||||||
|
|
||||||
|
if (Character.isUpperCase(firstChar)) {
|
||||||
|
// First char is already uppercase, just use paramName.
|
||||||
|
parameter.vendorExtensions.put("x-exportParamName", parameter.paramName);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// It's a lowercase first char, let's convert it to uppercase
|
||||||
|
StringBuilder sb = new StringBuilder(parameter.paramName);
|
||||||
|
sb.setCharAt(0, Character.toUpperCase(firstChar));
|
||||||
|
parameter.vendorExtensions.put("x-exportParamName", sb.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String apiDocFileFolder() {
|
||||||
|
return (outputFolder + "/" + apiDocPath).replace('/', File.separatorChar);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String modelDocFileFolder() {
|
||||||
|
return (outputFolder + "/" + modelDocPath).replace('/', File.separatorChar);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toModelDocFilename(String name) {
|
||||||
return toModelName(name);
|
return toModelName(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toApiDocFilename(String name) {
|
||||||
|
return toApiName(name);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTypeDeclaration(Property p) {
|
public String getTypeDeclaration(Property p) {
|
||||||
if(p instanceof ArrayProperty) {
|
if(p instanceof ArrayProperty) {
|
||||||
@ -333,5 +404,4 @@ public class GoClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
public void setPackageVersion(String packageVersion) {
|
public void setPackageVersion(String packageVersion) {
|
||||||
this.packageVersion = packageVersion;
|
this.packageVersion = packageVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,345 +1,514 @@
|
|||||||
package io.swagger.codegen.languages;
|
package io.swagger.codegen.languages;
|
||||||
|
|
||||||
import io.swagger.codegen.*;
|
import io.swagger.codegen.*;
|
||||||
|
import io.swagger.models.ModelImpl;
|
||||||
|
import io.swagger.models.parameters.Parameter;
|
||||||
import io.swagger.models.properties.*;
|
import io.swagger.models.properties.*;
|
||||||
import io.swagger.models.Model;
|
import io.swagger.models.Model;
|
||||||
import io.swagger.models.Operation;
|
import io.swagger.models.Operation;
|
||||||
import io.swagger.models.Swagger;
|
import io.swagger.models.Swagger;
|
||||||
|
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
public class HaskellServantCodegen extends DefaultCodegen implements CodegenConfig {
|
public class HaskellServantCodegen extends DefaultCodegen implements CodegenConfig {
|
||||||
|
|
||||||
// source folder where to write the files
|
// source folder where to write the files
|
||||||
protected String sourceFolder = "src";
|
protected String sourceFolder = "src";
|
||||||
protected String apiVersion = "0.0.1";
|
protected String apiVersion = "0.0.1";
|
||||||
|
|
||||||
/**
|
|
||||||
* Configures the type of generator.
|
|
||||||
*
|
|
||||||
* @return the CodegenType for this generator
|
|
||||||
* @see io.swagger.codegen.CodegenType
|
|
||||||
*/
|
|
||||||
public CodegenType getTag() {
|
|
||||||
return CodegenType.SERVER;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
// How to encode special characters like $
|
||||||
* Configures a friendly name for the generator. This will be used by the generator
|
// They are translated to words like "Dollar" and prefixed with '
|
||||||
* to select the library with the -l flag.
|
// Then translated back during JSON encoding and decoding
|
||||||
*
|
private Map<Character, String> specialCharReplacements = new HashMap<Character, String>();
|
||||||
* @return the friendly name for the generator
|
|
||||||
*/
|
|
||||||
public String getName() {
|
|
||||||
return "haskell-servant";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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 HaskellServantCodegen library.";
|
|
||||||
}
|
|
||||||
|
|
||||||
public HaskellServantCodegen() {
|
|
||||||
super();
|
|
||||||
|
|
||||||
// set the output folder here
|
|
||||||
outputFolder = "generated-code/HaskellServantCodegen";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Models. You can write model files using the modelTemplateFiles map.
|
* Configures the type of generator.
|
||||||
* if you want to create one template for file, you can do so here.
|
*
|
||||||
* for multiple files for model, just put another entry in the `modelTemplateFiles` with
|
* @return the CodegenType for this generator
|
||||||
* a different extension
|
* @see io.swagger.codegen.CodegenType
|
||||||
*/
|
*/
|
||||||
modelTemplateFiles.put(
|
public CodegenType getTag() {
|
||||||
"model.mustache", // the template to use
|
return CodegenType.SERVER;
|
||||||
".hs"); // the extension for each file to write
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Api classes. You can write classes for each Api file with the apiTemplateFiles map.
|
* Configures a friendly name for the generator. This will be used by the generator
|
||||||
* as with models, add multiple entries with different extensions for multiple files per
|
* to select the library with the -l flag.
|
||||||
* class
|
*
|
||||||
|
* @return the friendly name for the generator
|
||||||
*/
|
*/
|
||||||
apiTemplateFiles.put(
|
public String getName() {
|
||||||
"api.mustache", // the template to use
|
return "haskell";
|
||||||
".hs"); // the extension for each file to write
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* 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 Haskell server and client library.";
|
||||||
|
}
|
||||||
|
|
||||||
|
public HaskellServantCodegen() {
|
||||||
|
super();
|
||||||
|
|
||||||
|
// Initialize special characters
|
||||||
|
specialCharReplacements.put('$', "Dollar");
|
||||||
|
specialCharReplacements.put('^', "Caret");
|
||||||
|
specialCharReplacements.put('|', "Pipe");
|
||||||
|
specialCharReplacements.put('=', "Equal");
|
||||||
|
specialCharReplacements.put('*', "Star");
|
||||||
|
specialCharReplacements.put('-', "Dash");
|
||||||
|
specialCharReplacements.put('&', "Ampersand");
|
||||||
|
specialCharReplacements.put('%', "Percent");
|
||||||
|
specialCharReplacements.put('#', "Hash");
|
||||||
|
specialCharReplacements.put('@', "At");
|
||||||
|
specialCharReplacements.put('!', "Exclamation");
|
||||||
|
specialCharReplacements.put('+', "Plus");
|
||||||
|
|
||||||
|
|
||||||
|
// set the output folder here
|
||||||
|
outputFolder = "generated-code/haskell-servant";
|
||||||
|
|
||||||
|
/*
|
||||||
* Template Location. This is the location which templates will be read from. The generator
|
* Template Location. This is the location which templates will be read from. The generator
|
||||||
* will use the resource stream to attempt to read the templates.
|
* will use the resource stream to attempt to read the templates.
|
||||||
*/
|
*/
|
||||||
embeddedTemplateDir = templateDir = "haskell-servant";
|
embeddedTemplateDir = templateDir = "haskell-servant";
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Api Package. Optional, if needed, this can be used in templates
|
* Api Package. Optional, if needed, this can be used in templates
|
||||||
*/
|
*/
|
||||||
apiPackage = "Api";
|
apiPackage = "API";
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Model Package. Optional, if needed, this can be used in templates
|
* Model Package. Optional, if needed, this can be used in templates
|
||||||
*/
|
*/
|
||||||
modelPackage = "Model";
|
modelPackage = "Types";
|
||||||
|
|
||||||
/**
|
// Haskell keywords and reserved function names, taken mostly from https://wiki.haskell.org/Keywords
|
||||||
* Reserved words. Override this with reserved words specific to your language
|
setReservedWordsLowerCase(
|
||||||
*/
|
Arrays.asList(
|
||||||
// from https://wiki.haskell.org/Keywords
|
// Keywords
|
||||||
setReservedWordsLowerCase(
|
"as", "case", "of",
|
||||||
Arrays.asList(
|
"class", "data", "family",
|
||||||
"as", "case", "of",
|
"default", "deriving",
|
||||||
"class", "data", // "data family", "data instance",
|
"do", "forall", "foreign", "hiding",
|
||||||
"default", "deriving", // "deriving instance",
|
"if", "then", "else",
|
||||||
"do",
|
"import", "infix", "infixl", "infixr",
|
||||||
"forall", "foreign", "hiding",
|
"instance", "let", "in",
|
||||||
"id",
|
"mdo", "module", "newtype",
|
||||||
"if", "then", "else",
|
"proc", "qualified", "rec",
|
||||||
"import", "infix", "infixl", "infixr",
|
"type", "where"
|
||||||
"instance", "let", "in",
|
)
|
||||||
"mdo", "module", "newtype",
|
);
|
||||||
"proc", "qualified", "rec",
|
|
||||||
"type", // "type family", "type instance",
|
|
||||||
"where"
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Additional Properties. These values can be passed to the templates and
|
* Additional Properties. These values can be passed to the templates and
|
||||||
* are available in models, apis, and supporting files
|
* are available in models, apis, and supporting files
|
||||||
*/
|
*/
|
||||||
additionalProperties.put("apiVersion", apiVersion);
|
additionalProperties.put("apiVersion", apiVersion);
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Supporting Files. You can write single files for the generator with the
|
* Supporting Files. You can write single files for the generator with the
|
||||||
* entire object tree available. If the input file has a suffix of `.mustache
|
* entire object tree available. If the input file has a suffix of `.mustache
|
||||||
* it will be processed by the template engine. Otherwise, it will be copied
|
* it will be processed by the template engine. Otherwise, it will be copied
|
||||||
*/
|
*/
|
||||||
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
|
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
|
||||||
supportingFiles.add(new SupportingFile("stack.mustache", "", "stack.yaml"));
|
supportingFiles.add(new SupportingFile("stack.mustache", "", "stack.yaml"));
|
||||||
supportingFiles.add(new SupportingFile("haskell-servant-codegen.mustache", "", "haskell-servant-codegen.cabal"));
|
supportingFiles.add(new SupportingFile("Setup.mustache", "", "Setup.hs"));
|
||||||
supportingFiles.add(new SupportingFile("Setup.mustache", "", "Setup.hs"));
|
|
||||||
supportingFiles.add(new SupportingFile("LICENSE", "", "LICENSE"));
|
|
||||||
supportingFiles.add(new SupportingFile("Apis.mustache", "lib", "Apis.hs"));
|
|
||||||
supportingFiles.add(new SupportingFile("Utils.mustache", "lib", "Utils.hs"));
|
|
||||||
supportingFiles.add(new SupportingFile("Client.mustache", "client", "Main.hs"));
|
|
||||||
supportingFiles.add(new SupportingFile("Server.mustache", "server", "Main.hs"));
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Language Specific Primitives. These types will not trigger imports by
|
* Language Specific Primitives. These types will not trigger imports by
|
||||||
* the client generator
|
* the client generator
|
||||||
*/
|
*/
|
||||||
languageSpecificPrimitives = new HashSet<String>(
|
languageSpecificPrimitives = new HashSet<String>(
|
||||||
Arrays.asList(
|
Arrays.asList(
|
||||||
"Bool",
|
"Bool",
|
||||||
"String",
|
"String",
|
||||||
"Int",
|
"Int",
|
||||||
"Integer",
|
"Integer",
|
||||||
"Float",
|
"Float",
|
||||||
"Char",
|
"Char",
|
||||||
"Double",
|
"Double",
|
||||||
"List",
|
"List",
|
||||||
"FilePath"
|
"FilePath"
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
typeMapping.clear();
|
typeMapping.clear();
|
||||||
// typeMapping.put("enum", "NSString");
|
typeMapping.put("array", "List");
|
||||||
typeMapping.put("array", "List");
|
typeMapping.put("set", "Set");
|
||||||
typeMapping.put("set", "Set");
|
typeMapping.put("boolean", "Bool");
|
||||||
typeMapping.put("boolean", "Bool");
|
typeMapping.put("string", "Text");
|
||||||
typeMapping.put("string", "String");
|
typeMapping.put("int", "Int");
|
||||||
typeMapping.put("int", "Int");
|
typeMapping.put("long", "Integer");
|
||||||
typeMapping.put("long", "Integer");
|
typeMapping.put("short", "Int");
|
||||||
typeMapping.put("float", "Float");
|
typeMapping.put("char", "Char");
|
||||||
// typeMapping.put("byte", "Byte");
|
typeMapping.put("float", "Float");
|
||||||
typeMapping.put("short", "Int");
|
typeMapping.put("double", "Double");
|
||||||
typeMapping.put("char", "Char");
|
typeMapping.put("DateTime", "Integer");
|
||||||
typeMapping.put("double", "Double");
|
typeMapping.put("file", "FilePath");
|
||||||
typeMapping.put("DateTime", "Integer");
|
typeMapping.put("number", "Double");
|
||||||
// typeMapping.put("object", "Map");
|
typeMapping.put("integer", "Int");
|
||||||
typeMapping.put("file", "FilePath");
|
typeMapping.put("any", "Value");
|
||||||
|
|
||||||
importMapping.clear();
|
importMapping.clear();
|
||||||
importMapping.put("Map", "qualified Data.Map as Map");
|
importMapping.put("Map", "qualified Data.Map as Map");
|
||||||
|
|
||||||
cliOptions.add(new CliOption(CodegenConstants.MODEL_PACKAGE, CodegenConstants.MODEL_PACKAGE_DESC));
|
cliOptions.add(new CliOption(CodegenConstants.MODEL_PACKAGE, CodegenConstants.MODEL_PACKAGE_DESC));
|
||||||
cliOptions.add(new CliOption(CodegenConstants.API_PACKAGE, CodegenConstants.API_PACKAGE_DESC));
|
cliOptions.add(new CliOption(CodegenConstants.API_PACKAGE, CodegenConstants.API_PACKAGE_DESC));
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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 + "_";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Location to write model files. You can use the modelPackage() as defined when the class is
|
|
||||||
* instantiated
|
|
||||||
*/
|
|
||||||
public String modelFileFolder() {
|
|
||||||
return outputFolder + File.separatorChar + "lib" + File.separatorChar + modelPackage().replace('.', File.separatorChar);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Location to write api files. You can use the apiPackage() as defined when the class is
|
|
||||||
* instantiated
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public String apiFileFolder() {
|
|
||||||
return outputFolder + File.separatorChar + "lib" + File.separatorChar + apiPackage().replace('.', File.separatorChar);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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) {
|
|
||||||
if(p instanceof ArrayProperty) {
|
|
||||||
ArrayProperty ap = (ArrayProperty) p;
|
|
||||||
Property inner = ap.getItems();
|
|
||||||
return "[" + getTypeDeclaration(inner) + "]";
|
|
||||||
}
|
}
|
||||||
else if (p instanceof MapProperty) {
|
|
||||||
MapProperty mp = (MapProperty) p;
|
|
||||||
Property inner = mp.getAdditionalProperties();
|
|
||||||
return "Map.Map String " + getTypeDeclaration(inner);
|
|
||||||
}
|
|
||||||
return super.getTypeDeclaration(p);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Optional - swagger type conversion. This is used to map swagger types in a `Property` into
|
* Escapes a reserved word as defined in the `reservedWords` array. Handle escaping
|
||||||
* either language specific types via `typeMapping` or into complex models if there is not a mapping.
|
* those terms here. This logic is only called if a variable matches the reseved words
|
||||||
*
|
*
|
||||||
* @return a string value of the type or complex model for this property
|
* @return the escaped term
|
||||||
* @see io.swagger.models.properties.Property
|
*/
|
||||||
*/
|
@Override
|
||||||
@Override
|
public String escapeReservedWord(String name) {
|
||||||
public String getSwaggerType(Property p) {
|
return name + "_";
|
||||||
String swaggerType = super.getSwaggerType(p);
|
}
|
||||||
String type = null;
|
|
||||||
if(typeMapping.containsKey(swaggerType)) {
|
@Override
|
||||||
type = typeMapping.get(swaggerType);
|
public void preprocessSwagger(Swagger swagger) {
|
||||||
if(languageSpecificPrimitives.contains(type))
|
// From the title, compute a reasonable name for the package and the API
|
||||||
|
String title = swagger.getInfo().getTitle();
|
||||||
|
|
||||||
|
// Drop any API suffix
|
||||||
|
if(title == null) {
|
||||||
|
title = "Swagger";
|
||||||
|
} else {
|
||||||
|
title = title.trim();
|
||||||
|
if (title.toUpperCase().endsWith("API")) {
|
||||||
|
title = title.substring(0, title.length() - 3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String[] words = title.split(" ");
|
||||||
|
|
||||||
|
// The package name is made by appending the lowercased words of the title interspersed with dashes
|
||||||
|
List<String> wordsLower = new ArrayList<String>();
|
||||||
|
for (String word : words) {
|
||||||
|
wordsLower.add(word.toLowerCase());
|
||||||
|
}
|
||||||
|
String cabalName = joinStrings("-", wordsLower);
|
||||||
|
|
||||||
|
// The API name is made by appending the capitalized words of the title
|
||||||
|
List<String> wordsCaps = new ArrayList<String>();
|
||||||
|
for (String word : words) {
|
||||||
|
wordsCaps.add(word.substring(0, 1).toUpperCase() + word.substring(1));
|
||||||
|
}
|
||||||
|
String apiName = joinStrings("", wordsCaps);
|
||||||
|
|
||||||
|
// Set the filenames to write for the API
|
||||||
|
supportingFiles.add(new SupportingFile("haskell-servant-codegen.mustache", "", cabalName + ".cabal"));
|
||||||
|
supportingFiles.add(new SupportingFile("API.mustache", "lib/" + apiName, "API.hs"));
|
||||||
|
supportingFiles.add(new SupportingFile("Types.mustache", "lib/" + apiName, "Types.hs"));
|
||||||
|
|
||||||
|
|
||||||
|
additionalProperties.put("title", apiName);
|
||||||
|
additionalProperties.put("titleLower", apiName.substring(0, 1).toLowerCase() + apiName.substring(1));
|
||||||
|
additionalProperties.put("package", cabalName);
|
||||||
|
|
||||||
|
// Due to the way servant resolves types, we need a high context stack limit
|
||||||
|
additionalProperties.put("contextStackLimit", swagger.getPaths().size() * 2 + 300);
|
||||||
|
|
||||||
|
List<Map<String, Object>> replacements = new ArrayList<>();
|
||||||
|
Object[] replacementChars = specialCharReplacements.keySet().toArray();
|
||||||
|
for(int i = 0; i < replacementChars.length; i++) {
|
||||||
|
Character c = (Character) replacementChars[i];
|
||||||
|
Map<String, Object> o = new HashMap<>();
|
||||||
|
o.put("char", Character.toString(c));
|
||||||
|
o.put("replacement", "'" + specialCharReplacements.get(c));
|
||||||
|
o.put("hasMore", i != replacementChars.length - 1);
|
||||||
|
replacements.add(o);
|
||||||
|
}
|
||||||
|
additionalProperties.put("specialCharReplacements", replacements);
|
||||||
|
|
||||||
|
super.preprocessSwagger(swagger);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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) {
|
||||||
|
if (p instanceof ArrayProperty) {
|
||||||
|
ArrayProperty ap = (ArrayProperty) p;
|
||||||
|
Property inner = ap.getItems();
|
||||||
|
return "[" + getTypeDeclaration(inner) + "]";
|
||||||
|
} else if (p instanceof MapProperty) {
|
||||||
|
MapProperty mp = (MapProperty) p;
|
||||||
|
Property inner = mp.getAdditionalProperties();
|
||||||
|
return "Map.Map String " + getTypeDeclaration(inner);
|
||||||
|
}
|
||||||
|
return fixModelChars(super.getTypeDeclaration(p));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 if(swaggerType == "object") {
|
||||||
|
type = "Value";
|
||||||
|
} else if(typeMapping.containsValue(swaggerType)) {
|
||||||
|
type = swaggerType + "_";
|
||||||
|
} else {
|
||||||
|
type = swaggerType;
|
||||||
|
}
|
||||||
return toModelName(type);
|
return toModelName(type);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
type = swaggerType;
|
|
||||||
return toModelName(type);
|
|
||||||
}
|
|
||||||
|
|
||||||
private String capturePath(String path, List<CodegenParameter> pathParams) {
|
@Override
|
||||||
for (CodegenParameter p : pathParams) {
|
public String toInstantiationType(Property p) {
|
||||||
String pName = "{"+p.baseName+"}";
|
if (p instanceof MapProperty) {
|
||||||
if (path.indexOf(pName) >= 0) {
|
MapProperty ap = (MapProperty) p;
|
||||||
path = path.replace(pName, "Capture " + "\""+p.baseName+"\" " + p.dataType);
|
Property additionalProperties2 = ap.getAdditionalProperties();
|
||||||
}
|
String type = additionalProperties2.getType();
|
||||||
|
if (null == type) {
|
||||||
|
LOGGER.error("No Type defined for Additional Property " + additionalProperties2 + "\n" //
|
||||||
|
+ "\tIn Property: " + p);
|
||||||
|
}
|
||||||
|
String inner = getSwaggerType(additionalProperties2);
|
||||||
|
return "(Map.Map Text " + inner + ")";
|
||||||
|
} else if (p instanceof ArrayProperty) {
|
||||||
|
ArrayProperty ap = (ArrayProperty) p;
|
||||||
|
String inner = getSwaggerType(ap.getItems());
|
||||||
|
// Return only the inner type; the wrapping with QueryList is done
|
||||||
|
// somewhere else, where we have access to the collection format.
|
||||||
|
return inner;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return path;
|
|
||||||
}
|
|
||||||
|
|
||||||
private String queryPath(String path, List<CodegenParameter> queryParams) {
|
|
||||||
for (CodegenParameter p : queryParams) {
|
// Intersperse a separator string between a list of strings, like String.join.
|
||||||
path += " :> QueryParam \"" + p.baseName + "\" " + p.dataType;
|
private String joinStrings(String sep, List<String> ss) {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
for (String s : ss) {
|
||||||
|
if (sb.length() > 0) {
|
||||||
|
sb.append(sep);
|
||||||
|
}
|
||||||
|
sb.append(s);
|
||||||
|
}
|
||||||
|
return sb.toString();
|
||||||
}
|
}
|
||||||
return path;
|
|
||||||
}
|
|
||||||
|
|
||||||
private String bodyPath(String path, List<CodegenParameter> bodyParams) {
|
// Convert an HTTP path to a Servant route, including captured parameters.
|
||||||
for (CodegenParameter p : bodyParams) {
|
// For example, the path /api/jobs/info/{id}/last would become:
|
||||||
path += " :> ReqBody '[JSON] " + p.dataType;
|
// "api" :> "jobs" :> "info" :> Capture "id" IdType :> "last"
|
||||||
|
// IdType is provided by the capture params.
|
||||||
|
private List<String> pathToServantRoute(String path, List<CodegenParameter> pathParams) {
|
||||||
|
// Map the capture params by their names.
|
||||||
|
HashMap<String, String> captureTypes = new HashMap<String, String>();
|
||||||
|
for (CodegenParameter param : pathParams) {
|
||||||
|
captureTypes.put(param.baseName, param.dataType);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Cut off the leading slash, if it is present.
|
||||||
|
if (path.startsWith("/")) {
|
||||||
|
path = path.substring(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert the path into a list of servant route components.
|
||||||
|
List<String> pathComponents = new ArrayList<String>();
|
||||||
|
for (String piece : path.split("/")) {
|
||||||
|
if (piece.startsWith("{") && piece.endsWith("}")) {
|
||||||
|
String name = piece.substring(1, piece.length() - 1);
|
||||||
|
pathComponents.add("Capture \"" + name + "\" " + captureTypes.get(name));
|
||||||
|
} else {
|
||||||
|
pathComponents.add("\"" + piece + "\"");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Intersperse the servant route pieces with :> to construct the final API type
|
||||||
|
return pathComponents;
|
||||||
}
|
}
|
||||||
return path;
|
|
||||||
}
|
|
||||||
|
|
||||||
private String formPath(String path, List<CodegenParameter> formParams) {
|
// Extract the arguments that are passed in the route path parameters
|
||||||
String names = "Form";
|
private List<String> pathToClientType(String path, List<CodegenParameter> pathParams) {
|
||||||
for (CodegenParameter p : formParams) {
|
// Map the capture params by their names.
|
||||||
if(p.dataType.equals("FilePath")){
|
HashMap<String, String> captureTypes = new HashMap<String, String>();
|
||||||
// file data processing
|
for (CodegenParameter param : pathParams) {
|
||||||
}
|
captureTypes.put(param.baseName, param.dataType);
|
||||||
names += p.baseName;
|
}
|
||||||
|
|
||||||
|
// Cut off the leading slash, if it is present.
|
||||||
|
if (path.startsWith("/")) {
|
||||||
|
path = path.substring(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert the path into a list of servant route components.
|
||||||
|
List<String> type = new ArrayList<String>();
|
||||||
|
for (String piece : path.split("/")) {
|
||||||
|
if (piece.startsWith("{") && piece.endsWith("}")) {
|
||||||
|
String name = piece.substring(1, piece.length() - 1);
|
||||||
|
type.add(captureTypes.get(name));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return type;
|
||||||
}
|
}
|
||||||
if(formParams.size() > 0){
|
|
||||||
path += " :> ReqBody '[FormUrlEncoded] " + names;
|
|
||||||
|
@Override
|
||||||
|
public CodegenOperation fromOperation(String resourcePath, String httpMethod, Operation operation, Map<String, Model> definitions, Swagger swagger) {
|
||||||
|
CodegenOperation op = super.fromOperation(resourcePath, httpMethod, operation, definitions, swagger);
|
||||||
|
|
||||||
|
List<String> path = pathToServantRoute(op.path, op.pathParams);
|
||||||
|
List<String> type = pathToClientType(op.path, op.pathParams);
|
||||||
|
|
||||||
|
// Query parameters appended to routes
|
||||||
|
for (CodegenParameter param : op.queryParams) {
|
||||||
|
String paramType = param.dataType;
|
||||||
|
if(param.isListContainer != null && param.isListContainer) {
|
||||||
|
paramType = makeQueryListType(paramType, param.collectionFormat);
|
||||||
|
}
|
||||||
|
path.add("QueryParam \"" + param.baseName + "\" " + paramType);
|
||||||
|
type.add("Maybe " + param.dataType);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Either body or form data parameters appended to route
|
||||||
|
// As far as I know, you cannot have two ReqBody routes.
|
||||||
|
// Is it possible to have body params AND have form params?
|
||||||
|
String bodyType = null;
|
||||||
|
if (op.getHasBodyParam()) {
|
||||||
|
for (CodegenParameter param : op.bodyParams) {
|
||||||
|
path.add("ReqBody '[JSON] " + param.dataType);
|
||||||
|
bodyType = param.dataType;
|
||||||
|
}
|
||||||
|
} else if(op.getHasFormParams()) {
|
||||||
|
// Use the FormX data type, where X is the conglomerate of all things being passed
|
||||||
|
String formName = "Form" + camelize(op.operationId);
|
||||||
|
bodyType = formName;
|
||||||
|
path.add("ReqBody '[FormUrlEncoded] " + formName);
|
||||||
|
}
|
||||||
|
if(bodyType != null) {
|
||||||
|
type.add(bodyType);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Special headers appended to route
|
||||||
|
for (CodegenParameter param : op.headerParams) {
|
||||||
|
path.add("Header \"" + param.baseName + "\" " + param.dataType);
|
||||||
|
|
||||||
|
String paramType = param.dataType;
|
||||||
|
if(param.isListContainer != null && param.isListContainer) {
|
||||||
|
paramType = makeQueryListType(paramType, param.collectionFormat);
|
||||||
|
}
|
||||||
|
type.add("Maybe " + paramType);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add the HTTP method and return type
|
||||||
|
String returnType = op.returnType;
|
||||||
|
if (returnType == null || returnType.equals("null")) {
|
||||||
|
returnType = "()";
|
||||||
|
}
|
||||||
|
if (returnType.indexOf(" ") >= 0) {
|
||||||
|
returnType = "(" + returnType + ")";
|
||||||
|
}
|
||||||
|
path.add("Verb '" + op.httpMethod.toUpperCase() + " 200 '[JSON] " + returnType);
|
||||||
|
type.add("m " + returnType);
|
||||||
|
|
||||||
|
op.vendorExtensions.put("x-routeType", joinStrings(" :> ", path));
|
||||||
|
op.vendorExtensions.put("x-clientType", joinStrings(" -> ", type));
|
||||||
|
op.vendorExtensions.put("x-formName", "Form" + camelize(op.operationId));
|
||||||
|
for(CodegenParameter param : op.formParams) {
|
||||||
|
param.vendorExtensions.put("x-formPrefix", camelize(op.operationId, true));
|
||||||
|
}
|
||||||
|
return op;
|
||||||
}
|
}
|
||||||
return path;
|
|
||||||
}
|
|
||||||
|
|
||||||
private String headerPath(String path, List<CodegenParameter> headerParams) {
|
private String makeQueryListType(String type, String collectionFormat) {
|
||||||
for (CodegenParameter p : headerParams) {
|
type = type.substring(1, type.length() - 1);
|
||||||
path += " :> Header \"" + p.baseName + "\" " + p.dataType;
|
switch(collectionFormat) {
|
||||||
|
case "csv": return "(QueryList 'CommaSeparated (" + type + "))";
|
||||||
|
case "tsv": return "(QueryList 'TabSeparated (" + type + "))";
|
||||||
|
case "ssv": return "(QueryList 'SpaceSeparated (" + type + "))";
|
||||||
|
case "pipes": return "(QueryList 'PipeSeparated (" + type + "))";
|
||||||
|
case "multi": return "(QueryList 'MultiParamArray (" + type + "))";
|
||||||
|
default:
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return path;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
private String fixOperatorChars(String string) {
|
||||||
private String filterReturnType(String rt) {
|
StringBuilder sb = new StringBuilder();
|
||||||
if (rt == null || rt.equals("null")) {
|
for (char c : string.toCharArray()) {
|
||||||
return "()";
|
if (specialCharReplacements.containsKey(c)) {
|
||||||
} else if (rt.indexOf(" ") >= 0) {
|
sb.append("'");
|
||||||
return "(" + rt + ")";
|
sb.append(specialCharReplacements.get(c));
|
||||||
|
} else {
|
||||||
|
sb.append(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return sb.toString();
|
||||||
}
|
}
|
||||||
return rt;
|
|
||||||
}
|
|
||||||
|
|
||||||
private String addReturnPath(String path, String httpMethod, String returnType) {
|
// Remove characters from a string that do not belong in a model classname
|
||||||
return path + " :> " + upperCaseFirst(httpMethod) + " '[JSON] " + filterReturnType(returnType);
|
private String fixModelChars(String string) {
|
||||||
}
|
return string.replace(".", "").replace("-", "");
|
||||||
|
|
||||||
private String joinStrings(String sep, List<String> ss) {
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
for (String s : ss) {
|
|
||||||
if (sb.length() > 0) {
|
|
||||||
sb.append(sep);
|
|
||||||
}
|
|
||||||
sb.append(s);
|
|
||||||
}
|
}
|
||||||
return sb.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
private String replacePathSplitter(String path) {
|
// Override fromModel to create the appropriate model namings
|
||||||
String[] ps = path.replaceFirst("/", "").split("/", 0);
|
@Override
|
||||||
List<String> rs = new ArrayList<String>();
|
public CodegenModel fromModel(String name, Model mod, Map<String, Model> allDefinitions) {
|
||||||
for (String p : ps) {
|
CodegenModel model = super.fromModel(name, mod, allDefinitions);
|
||||||
if (p.indexOf("{") < 0) {
|
|
||||||
rs.add("\"" + p + "\"");
|
// Clean up the class name to remove invalid characters
|
||||||
} else {
|
model.classname = fixModelChars(model.classname);
|
||||||
rs.add(p);
|
if(typeMapping.containsValue(model.classname)) {
|
||||||
}
|
model.classname += "_";
|
||||||
|
}
|
||||||
|
|
||||||
|
// From the model name, compute the prefix for the fields.
|
||||||
|
String prefix = camelize(model.classname, true);
|
||||||
|
for(CodegenProperty prop : model.vars) {
|
||||||
|
prop.name = prefix + camelize(fixOperatorChars(prop.name));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create newtypes for things with non-object types
|
||||||
|
String dataOrNewtype = "data";
|
||||||
|
String modelType = ((ModelImpl) mod).getType();
|
||||||
|
if(modelType != "object" && typeMapping.containsKey(modelType)) {
|
||||||
|
String newtype = typeMapping.get(modelType);
|
||||||
|
model.vendorExtensions.put("x-customNewtype", newtype);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Provide the prefix as a vendor extension, so that it can be used in the ToJSON and FromJSON instances.
|
||||||
|
model.vendorExtensions.put("x-prefix", prefix);
|
||||||
|
model.vendorExtensions.put("x-data", dataOrNewtype);
|
||||||
|
|
||||||
|
return model;
|
||||||
}
|
}
|
||||||
return joinStrings(" :> ", rs);
|
|
||||||
}
|
|
||||||
|
|
||||||
private String upperCaseFirst(String str) {
|
|
||||||
char[] array = str.toLowerCase().toCharArray();
|
|
||||||
array[0] = Character.toUpperCase(array[0]);
|
|
||||||
return new String(array);
|
|
||||||
}
|
|
||||||
|
|
||||||
private String parseScheme(String basePath) {
|
|
||||||
return "Http";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public CodegenOperation fromOperation(String resourcePath, String httpMethod, Operation operation, Map<String, Model> definitions, Swagger swagger){
|
|
||||||
CodegenOperation op = super.fromOperation(resourcePath, httpMethod, operation, definitions, swagger);
|
|
||||||
String path = op.path;
|
|
||||||
op.nickname = addReturnPath(headerPath(formPath(bodyPath(queryPath(capturePath(replacePathSplitter(path), op.pathParams), op.queryParams), op.bodyParams), op.formParams), op.headerParams), op.httpMethod, op.returnType);
|
|
||||||
return op;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CodegenParameter fromParameter(Parameter param, Set<String> imports) {
|
||||||
|
CodegenParameter p = super.fromParameter(param, imports);
|
||||||
|
p.vendorExtensions.put("x-formParamName", camelize(p.baseName));
|
||||||
|
p.dataType = fixModelChars(p.dataType);
|
||||||
|
return p;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -122,7 +122,7 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
|
|||||||
typeMapping.put("float", "Number");
|
typeMapping.put("float", "Number");
|
||||||
typeMapping.put("number", "Number");
|
typeMapping.put("number", "Number");
|
||||||
typeMapping.put("DateTime", "Date"); // Should this be dateTime?
|
typeMapping.put("DateTime", "Date"); // Should this be dateTime?
|
||||||
typeMapping.put("Date", "Date"); // Should this be date?
|
typeMapping.put("date", "Date"); // Should this be date?
|
||||||
typeMapping.put("long", "Integer");
|
typeMapping.put("long", "Integer");
|
||||||
typeMapping.put("short", "Integer");
|
typeMapping.put("short", "Integer");
|
||||||
typeMapping.put("char", "String");
|
typeMapping.put("char", "String");
|
||||||
|
@ -79,7 +79,7 @@ public class JavascriptClosureAngularClientCodegen extends DefaultCodegen implem
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getHelp() {
|
public String getHelp() {
|
||||||
return "Generates a Javascript AngularJS client library annotated with Google Closure Compiler annotations" +
|
return "Generates a Javascript AngularJS client library (beta) annotated with Google Closure Compiler annotations" +
|
||||||
"(https://developers.google.com/closure/compiler/docs/js-for-compiler?hl=en)";
|
"(https://developers.google.com/closure/compiler/docs/js-for-compiler?hl=en)";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,6 +95,7 @@ public class PerlClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
//TODO binary should be mapped to byte array
|
//TODO binary should be mapped to byte array
|
||||||
// mapped to String as a workaround
|
// mapped to String as a workaround
|
||||||
typeMapping.put("binary", "string");
|
typeMapping.put("binary", "string");
|
||||||
|
typeMapping.put("ByteArray", "string");
|
||||||
|
|
||||||
cliOptions.clear();
|
cliOptions.clear();
|
||||||
cliOptions.add(new CliOption(MODULE_NAME, "Perl module name (convention: CamelCase or Long::Module).").defaultValue("SwaggerClient"));
|
cliOptions.add(new CliOption(MODULE_NAME, "Perl module name (convention: CamelCase or Long::Module).").defaultValue("SwaggerClient"));
|
||||||
|
@ -110,6 +110,7 @@ public class PhpClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
typeMapping.put("list", "array");
|
typeMapping.put("list", "array");
|
||||||
typeMapping.put("object", "object");
|
typeMapping.put("object", "object");
|
||||||
typeMapping.put("binary", "string");
|
typeMapping.put("binary", "string");
|
||||||
|
typeMapping.put("ByteArray", "string");
|
||||||
|
|
||||||
cliOptions.add(new CliOption(CodegenConstants.MODEL_PACKAGE, CodegenConstants.MODEL_PACKAGE_DESC));
|
cliOptions.add(new CliOption(CodegenConstants.MODEL_PACKAGE, CodegenConstants.MODEL_PACKAGE_DESC));
|
||||||
cliOptions.add(new CliOption(CodegenConstants.API_PACKAGE, CodegenConstants.API_PACKAGE_DESC));
|
cliOptions.add(new CliOption(CodegenConstants.API_PACKAGE, CodegenConstants.API_PACKAGE_DESC));
|
||||||
|
@ -61,6 +61,7 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig
|
|||||||
//TODO binary should be mapped to byte array
|
//TODO binary should be mapped to byte array
|
||||||
// mapped to String as a workaround
|
// mapped to String as a workaround
|
||||||
typeMapping.put("binary", "str");
|
typeMapping.put("binary", "str");
|
||||||
|
typeMapping.put("ByteArray", "str");
|
||||||
|
|
||||||
// from https://docs.python.org/release/2.5.4/ref/keywords.html
|
// from https://docs.python.org/release/2.5.4/ref/keywords.html
|
||||||
setReservedWordsLowerCase(
|
setReservedWordsLowerCase(
|
||||||
|
@ -116,6 +116,7 @@ public class RubyClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
typeMapping.put("object", "Object");
|
typeMapping.put("object", "Object");
|
||||||
typeMapping.put("file", "File");
|
typeMapping.put("file", "File");
|
||||||
typeMapping.put("binary", "String");
|
typeMapping.put("binary", "String");
|
||||||
|
typeMapping.put("ByteArray", "String");
|
||||||
|
|
||||||
// remove modelPackage and apiPackage added by default
|
// remove modelPackage and apiPackage added by default
|
||||||
Iterator<CliOption> itr = cliOptions.iterator();
|
Iterator<CliOption> itr = cliOptions.iterator();
|
||||||
|
@ -101,6 +101,7 @@ public class ScalaClientCodegen extends DefaultCodegen implements CodegenConfig
|
|||||||
//TODO binary should be mapped to byte array
|
//TODO binary should be mapped to byte array
|
||||||
// mapped to String as a workaround
|
// mapped to String as a workaround
|
||||||
typeMapping.put("binary", "String");
|
typeMapping.put("binary", "String");
|
||||||
|
typeMapping.put("ByteArray", "String");
|
||||||
|
|
||||||
languageSpecificPrimitives = new HashSet<String>(
|
languageSpecificPrimitives = new HashSet<String>(
|
||||||
Arrays.asList(
|
Arrays.asList(
|
||||||
|
@ -32,18 +32,6 @@ public class SpringMVCServerCodegen extends JavaClientCodegen {
|
|||||||
additionalProperties.put(CodegenConstants.API_PACKAGE, apiPackage);
|
additionalProperties.put(CodegenConstants.API_PACKAGE, apiPackage);
|
||||||
additionalProperties.put(CONFIG_PACKAGE, configPackage);
|
additionalProperties.put(CONFIG_PACKAGE, configPackage);
|
||||||
|
|
||||||
languageSpecificPrimitives = new HashSet<String>(
|
|
||||||
Arrays.asList(
|
|
||||||
"byte[]",
|
|
||||||
"String",
|
|
||||||
"boolean",
|
|
||||||
"Boolean",
|
|
||||||
"Double",
|
|
||||||
"Integer",
|
|
||||||
"Long",
|
|
||||||
"Float")
|
|
||||||
);
|
|
||||||
|
|
||||||
cliOptions.add(new CliOption(CONFIG_PACKAGE, "configuration package for generated code"));
|
cliOptions.add(new CliOption(CONFIG_PACKAGE, "configuration package for generated code"));
|
||||||
|
|
||||||
supportedLibraries.clear();
|
supportedLibraries.clear();
|
||||||
|
@ -97,6 +97,7 @@ public class SwiftCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
);
|
);
|
||||||
reservedWords = new HashSet<String>(
|
reservedWords = new HashSet<String>(
|
||||||
Arrays.asList(
|
Arrays.asList(
|
||||||
|
"Int", "Int32", "Int64", "Int64", "Float", "Double", "Bool", "Void", "String", "Character", "AnyObject",
|
||||||
"class", "Class", "break", "as", "associativity", "deinit", "case", "dynamicType", "convenience", "enum", "continue",
|
"class", "Class", "break", "as", "associativity", "deinit", "case", "dynamicType", "convenience", "enum", "continue",
|
||||||
"false", "dynamic", "extension", "default", "is", "didSet", "func", "do", "nil", "final", "import", "else",
|
"false", "dynamic", "extension", "default", "is", "didSet", "func", "do", "nil", "final", "import", "else",
|
||||||
"self", "get", "init", "fallthrough", "Self", "infix", "internal", "for", "super", "inout", "let", "if",
|
"self", "get", "init", "fallthrough", "Self", "infix", "internal", "for", "super", "inout", "let", "if",
|
||||||
@ -129,6 +130,7 @@ public class SwiftCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
//TODO binary should be mapped to byte array
|
//TODO binary should be mapped to byte array
|
||||||
// mapped to String as a workaround
|
// mapped to String as a workaround
|
||||||
typeMapping.put("binary", "String");
|
typeMapping.put("binary", "String");
|
||||||
|
typeMapping.put("ByteArray", "String");
|
||||||
|
|
||||||
importMapping = new HashMap<String, String>();
|
importMapping = new HashMap<String, String>();
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.IO;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using RestSharp;
|
using RestSharp;
|
||||||
using {{packageName}}.Client;
|
using {{packageName}}.Client;
|
||||||
|
@ -32,12 +32,12 @@ class {{classname}} {
|
|||||||
def queryParams = [:]
|
def queryParams = [:]
|
||||||
def headerParams = [:]
|
def headerParams = [:]
|
||||||
|
|
||||||
{{#requiredParamCount}}
|
{{#allParams}}
|
||||||
// verify required params are set
|
// verify required params are set
|
||||||
if({{/requiredParamCount}}{{#requiredParams}} {{paramName}} == null {{#hasMore}}|| {{/hasMore}}{{/requiredParams}}{{#requiredParamCount}}) {
|
if({{/allParams}}{{#required}} {{paramName}} == null {{#hasMore}}|| {{/hasMore}}{{/required}}{{#allParams}}) {
|
||||||
throw new RuntimeException("missing required params")
|
throw new RuntimeException("missing required params")
|
||||||
}
|
}
|
||||||
{{/requiredParamCount}}
|
{{/allParams}}
|
||||||
|
|
||||||
{{#queryParams}}if(!"null".equals(String.valueOf({{paramName}})))
|
{{#queryParams}}if(!"null".equals(String.valueOf({{paramName}})))
|
||||||
queryParams.put("{{paramName}}", String.valueOf({{paramName}}))
|
queryParams.put("{{paramName}}", String.valueOf({{paramName}}))
|
||||||
@ -53,4 +53,4 @@ class {{classname}} {
|
|||||||
}
|
}
|
||||||
{{/operation}}
|
{{/operation}}
|
||||||
}
|
}
|
||||||
{{/operations}}
|
{{/operations}}
|
||||||
|
@ -9,8 +9,8 @@ buildscript {
|
|||||||
jcenter()
|
jcenter()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:1.2.2'
|
classpath 'com.android.tools.build:gradle:1.5.+'
|
||||||
classpath 'com.github.dcendents:android-maven-plugin:1.2'
|
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -25,11 +25,11 @@ if(hasProperty('target') && target == 'android') {
|
|||||||
apply plugin: 'com.github.dcendents.android-maven'
|
apply plugin: 'com.github.dcendents.android-maven'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 22
|
compileSdkVersion 23
|
||||||
buildToolsVersion '22.0.0'
|
buildToolsVersion '23.0.2'
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 14
|
minSdkVersion 14
|
||||||
targetSdkVersion 22
|
targetSdkVersion 23
|
||||||
}
|
}
|
||||||
compileOptions {
|
compileOptions {
|
||||||
sourceCompatibility JavaVersion.VERSION_1_7
|
sourceCompatibility JavaVersion.VERSION_1_7
|
||||||
@ -98,7 +98,7 @@ ext {
|
|||||||
jackson_version = "2.4.2"
|
jackson_version = "2.4.2"
|
||||||
jersey_version = "1.18"
|
jersey_version = "1.18"
|
||||||
jodatime_version = "2.3"
|
jodatime_version = "2.3"
|
||||||
junit_version = "4.8.1"
|
junit_version = "4.12"
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
@ -9,8 +9,8 @@ buildscript {
|
|||||||
jcenter()
|
jcenter()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:1.2.2'
|
classpath 'com.android.tools.build:gradle:1.5.+'
|
||||||
classpath 'com.github.dcendents:android-maven-plugin:1.2'
|
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -25,11 +25,11 @@ if(hasProperty('target') && target == 'android') {
|
|||||||
apply plugin: 'com.github.dcendents.android-maven'
|
apply plugin: 'com.github.dcendents.android-maven'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 22
|
compileSdkVersion 23
|
||||||
buildToolsVersion '22.0.0'
|
buildToolsVersion '23.0.2'
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 14
|
minSdkVersion 14
|
||||||
targetSdkVersion 22
|
targetSdkVersion 23
|
||||||
}
|
}
|
||||||
compileOptions {
|
compileOptions {
|
||||||
sourceCompatibility JavaVersion.VERSION_1_7
|
sourceCompatibility JavaVersion.VERSION_1_7
|
||||||
|
@ -9,8 +9,8 @@ buildscript {
|
|||||||
jcenter()
|
jcenter()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:1.2.2'
|
classpath 'com.android.tools.build:gradle:1.5.+'
|
||||||
classpath 'com.github.dcendents:android-maven-plugin:1.2'
|
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -25,11 +25,11 @@ if(hasProperty('target') && target == 'android') {
|
|||||||
apply plugin: 'com.github.dcendents.android-maven'
|
apply plugin: 'com.github.dcendents.android-maven'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 22
|
compileSdkVersion 23
|
||||||
buildToolsVersion '22.0.0'
|
buildToolsVersion '23.0.2'
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 14
|
minSdkVersion 14
|
||||||
targetSdkVersion 22
|
targetSdkVersion 23
|
||||||
}
|
}
|
||||||
compileOptions {
|
compileOptions {
|
||||||
sourceCompatibility JavaVersion.VERSION_1_7
|
sourceCompatibility JavaVersion.VERSION_1_7
|
||||||
|
@ -9,8 +9,8 @@ buildscript {
|
|||||||
jcenter()
|
jcenter()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:1.2.2'
|
classpath 'com.android.tools.build:gradle:1.5.+'
|
||||||
classpath 'com.github.dcendents:android-maven-plugin:1.2'
|
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -25,11 +25,11 @@ if(hasProperty('target') && target == 'android') {
|
|||||||
apply plugin: 'com.github.dcendents.android-maven'
|
apply plugin: 'com.github.dcendents.android-maven'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 22
|
compileSdkVersion 23
|
||||||
buildToolsVersion '22.0.0'
|
buildToolsVersion '23.0.2'
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 14
|
minSdkVersion 14
|
||||||
targetSdkVersion 22
|
targetSdkVersion 23
|
||||||
}
|
}
|
||||||
compileOptions {
|
compileOptions {
|
||||||
sourceCompatibility JavaVersion.VERSION_1_7
|
sourceCompatibility JavaVersion.VERSION_1_7
|
||||||
@ -98,5 +98,5 @@ dependencies {
|
|||||||
compile 'com.squareup.okhttp:okhttp:2.7.2'
|
compile 'com.squareup.okhttp:okhttp:2.7.2'
|
||||||
compile 'com.squareup.okhttp:logging-interceptor:2.7.2'
|
compile 'com.squareup.okhttp:logging-interceptor:2.7.2'
|
||||||
compile 'com.google.code.gson:gson:2.3.1'
|
compile 'com.google.code.gson:gson:2.3.1'
|
||||||
testCompile 'junit:junit:4.8.1'
|
testCompile 'junit:junit:4.12'
|
||||||
}
|
}
|
||||||
|
@ -163,6 +163,6 @@
|
|||||||
<okhttp-version>2.7.2</okhttp-version>
|
<okhttp-version>2.7.2</okhttp-version>
|
||||||
<gson-version>2.3.1</gson-version>
|
<gson-version>2.3.1</gson-version>
|
||||||
<maven-plugin-version>1.0.0</maven-plugin-version>
|
<maven-plugin-version>1.0.0</maven-plugin-version>
|
||||||
<junit-version>4.8.1</junit-version>
|
<junit-version>4.12</junit-version>
|
||||||
</properties>
|
</properties>
|
||||||
</project>
|
</project>
|
||||||
|
@ -9,8 +9,8 @@ buildscript {
|
|||||||
jcenter()
|
jcenter()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:1.2.2'
|
classpath 'com.android.tools.build:gradle:1.5.+'
|
||||||
classpath 'com.github.dcendents:android-maven-plugin:1.2'
|
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -25,11 +25,11 @@ if(hasProperty('target') && target == 'android') {
|
|||||||
apply plugin: 'com.github.dcendents.android-maven'
|
apply plugin: 'com.github.dcendents.android-maven'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 22
|
compileSdkVersion 23
|
||||||
buildToolsVersion '22.0.0'
|
buildToolsVersion '23.0.2'
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 14
|
minSdkVersion 14
|
||||||
targetSdkVersion 22
|
targetSdkVersion 23
|
||||||
}
|
}
|
||||||
compileOptions {
|
compileOptions {
|
||||||
sourceCompatibility JavaVersion.VERSION_1_7
|
sourceCompatibility JavaVersion.VERSION_1_7
|
||||||
|
@ -9,8 +9,8 @@ buildscript {
|
|||||||
jcenter()
|
jcenter()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:1.2.2'
|
classpath 'com.android.tools.build:gradle:1.5.+'
|
||||||
classpath 'com.github.dcendents:android-maven-plugin:1.2'
|
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -25,11 +25,11 @@ if(hasProperty('target') && target == 'android') {
|
|||||||
apply plugin: 'com.github.dcendents.android-maven'
|
apply plugin: 'com.github.dcendents.android-maven'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 22
|
compileSdkVersion 23
|
||||||
buildToolsVersion '22.0.0'
|
buildToolsVersion '23.0.2'
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 14
|
minSdkVersion 14
|
||||||
targetSdkVersion 22
|
targetSdkVersion 23
|
||||||
}
|
}
|
||||||
compileOptions {
|
compileOptions {
|
||||||
sourceCompatibility JavaVersion.VERSION_1_7
|
sourceCompatibility JavaVersion.VERSION_1_7
|
||||||
|
@ -176,6 +176,6 @@
|
|||||||
<jackson-version>2.4.2</jackson-version>
|
<jackson-version>2.4.2</jackson-version>
|
||||||
<jodatime-version>2.3</jodatime-version>
|
<jodatime-version>2.3</jodatime-version>
|
||||||
<maven-plugin-version>1.0.0</maven-plugin-version>
|
<maven-plugin-version>1.0.0</maven-plugin-version>
|
||||||
<junit-version>4.8.1</junit-version>
|
<junit-version>4.12</junit-version>
|
||||||
</properties>
|
</properties>
|
||||||
</project>
|
</project>
|
||||||
|
@ -29,8 +29,8 @@ import java.util.List;
|
|||||||
import static org.springframework.http.MediaType.*;
|
import static org.springframework.http.MediaType.*;
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping(value = "/{{baseName}}", produces = {APPLICATION_JSON_VALUE})
|
@RequestMapping(value = "/{{{baseName}}}", produces = {APPLICATION_JSON_VALUE})
|
||||||
@Api(value = "/{{baseName}}", description = "the {{baseName}} API")
|
@Api(value = "/{{{baseName}}}", description = "the {{{baseName}}} API")
|
||||||
{{>generatedAnnotation}}
|
{{>generatedAnnotation}}
|
||||||
{{#operations}}
|
{{#operations}}
|
||||||
public class {{classname}} {
|
public class {{classname}} {
|
||||||
@ -44,8 +44,8 @@ public class {{classname}} {
|
|||||||
{{/hasMore}}{{/authMethods}}
|
{{/hasMore}}{{/authMethods}}
|
||||||
}{{/hasAuthMethods}})
|
}{{/hasAuthMethods}})
|
||||||
@io.swagger.annotations.ApiResponses(value = { {{#responses}}
|
@io.swagger.annotations.ApiResponses(value = { {{#responses}}
|
||||||
@io.swagger.annotations.ApiResponse(code = {{{code}}}, message = "{{{message}}}"){{#hasMore}},{{/hasMore}}{{/responses}} })
|
@io.swagger.annotations.ApiResponse(code = {{{code}}}, message = "{{{message}}}", response = {{{returnType}}}.class){{#hasMore}},{{/hasMore}}{{/responses}} })
|
||||||
@RequestMapping(value = "{{path}}",
|
@RequestMapping(value = "{{{path}}}",
|
||||||
{{#hasProduces}}produces = { {{#produces}}"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }, {{/hasProduces}}
|
{{#hasProduces}}produces = { {{#produces}}"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }, {{/hasProduces}}
|
||||||
{{#hasConsumes}}consumes = { {{#consumes}}"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} },{{/hasConsumes}}
|
{{#hasConsumes}}consumes = { {{#consumes}}"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} },{{/hasConsumes}}
|
||||||
method = RequestMethod.{{httpMethod}})
|
method = RequestMethod.{{httpMethod}})
|
||||||
|
@ -1 +1 @@
|
|||||||
{{#isHeaderParam}}@ApiParam(value = "{{{description}}}" {{#required}},required=true{{/required}} {{#allowableValues}}, allowableValues="{{{allowableValues}}}"{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}) @RequestHeader(value="{{paramName}}", required={{#required}}true{{/required}}{{^required}}false{{/required}}) {{{dataType}}} {{paramName}}{{/isHeaderParam}}
|
{{#isHeaderParam}}@ApiParam(value = "{{{description}}}" {{#required}},required=true{{/required}} {{#allowableValues}}, allowableValues="{{{allowableValues}}}"{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}) @RequestHeader(value="{{baseName}}", required={{#required}}true{{/required}}{{^required}}false{{/required}}) {{{dataType}}} {{paramName}}{{/isHeaderParam}}
|
||||||
|
@ -129,7 +129,7 @@ Class | Method | HTTP request | Description
|
|||||||
{{/isBasic}}
|
{{/isBasic}}
|
||||||
{{#isOAuth}}- **Type**: OAuth
|
{{#isOAuth}}- **Type**: OAuth
|
||||||
- **Flow**: {{flow}}
|
- **Flow**: {{flow}}
|
||||||
- **Authorizatoin URL**: {{authorizationUrl}}
|
- **Authorization URL**: {{authorizationUrl}}
|
||||||
- **Scopes**: {{^scopes}}N/A{{/scopes}}
|
- **Scopes**: {{^scopes}}N/A{{/scopes}}
|
||||||
{{#scopes}} - {{scope}}: {{description}}
|
{{#scopes}} - {{scope}}: {{description}}
|
||||||
{{/scopes}}
|
{{/scopes}}
|
||||||
|
@ -80,7 +80,7 @@ Name | Type | Description | Notes
|
|||||||
|
|
||||||
{{^authMethods}}No authorization required{{/authMethods}}{{#authMethods}}[{{name}}](../README.md#{{name}}){{^-last}}, {{/-last}}{{/authMethods}}
|
{{^authMethods}}No authorization required{{/authMethods}}{{#authMethods}}[{{name}}](../README.md#{{name}}){{^-last}}, {{/-last}}{{/authMethods}}
|
||||||
|
|
||||||
### HTTP reuqest headers
|
### HTTP request headers
|
||||||
|
|
||||||
- **Content-Type**: {{#consumes}}{{mediaType}}{{#hasMore}}, {{/hasMore}}{{/consumes}}{{^consumes}}Not defined{{/consumes}}
|
- **Content-Type**: {{#consumes}}{{mediaType}}{{#hasMore}}, {{/hasMore}}{{/consumes}}{{^consumes}}Not defined{{/consumes}}
|
||||||
- **Accept**: {{#produces}}{{mediaType}}{{#hasMore}}, {{/hasMore}}{{/produces}}{{^produces}}Not defined{{/produces}}
|
- **Accept**: {{#produces}}{{mediaType}}{{#hasMore}}, {{/hasMore}}{{/produces}}{{^produces}}Not defined{{/produces}}
|
||||||
|
@ -96,13 +96,19 @@ class VoidAuth implements Authentication {
|
|||||||
* {{&description}}
|
* {{&description}}
|
||||||
*/
|
*/
|
||||||
{{/description}}
|
{{/description}}
|
||||||
|
export enum {{classname}}ApiKeys {
|
||||||
|
{{#authMethods}}
|
||||||
|
{{#isApiKey}}
|
||||||
|
{{name}},
|
||||||
|
{{/isApiKey}}
|
||||||
|
{{/authMethods}}
|
||||||
|
}
|
||||||
|
|
||||||
export class {{classname}} {
|
export class {{classname}} {
|
||||||
protected basePath = '{{basePath}}';
|
protected basePath = '{{basePath}}';
|
||||||
protected defaultHeaders : any = {};
|
protected defaultHeaders : any = {};
|
||||||
|
|
||||||
|
protected authentications = {
|
||||||
|
|
||||||
public authentications = {
|
|
||||||
'default': <Authentication>new VoidAuth(),
|
'default': <Authentication>new VoidAuth(),
|
||||||
{{#authMethods}}
|
{{#authMethods}}
|
||||||
{{#isBasic}}
|
{{#isBasic}}
|
||||||
@ -140,6 +146,10 @@ export class {{classname}} {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public setApiKey(key: {{classname}}ApiKeys, value: string) {
|
||||||
|
this.authentications[{{classname}}ApiKeys[key]].apiKey = value;
|
||||||
|
}
|
||||||
{{#authMethods}}
|
{{#authMethods}}
|
||||||
{{#isBasic}}
|
{{#isBasic}}
|
||||||
|
|
||||||
@ -151,12 +161,6 @@ export class {{classname}} {
|
|||||||
this.authentications.{{name}}.password = password;
|
this.authentications.{{name}}.password = password;
|
||||||
}
|
}
|
||||||
{{/isBasic}}
|
{{/isBasic}}
|
||||||
{{#isApiKey}}
|
|
||||||
|
|
||||||
set apiKey(key: string) {
|
|
||||||
this.authentications.{{name}}.apiKey = key;
|
|
||||||
}
|
|
||||||
{{/isApiKey}}
|
|
||||||
{{#isOAuth}}
|
{{#isOAuth}}
|
||||||
|
|
||||||
set accessToken(token: string) {
|
set accessToken(token: string) {
|
||||||
@ -186,9 +190,9 @@ export class {{classname}} {
|
|||||||
let formParams: any = {};
|
let formParams: any = {};
|
||||||
|
|
||||||
{{#allParams}}{{#required}}
|
{{#allParams}}{{#required}}
|
||||||
// verify required parameter '{{paramName}}' is set
|
// verify required parameter '{{paramName}}' is not null or undefined
|
||||||
if (!{{paramName}}) {
|
if ({{paramName}} === null || {{paramName}} === undefined) {
|
||||||
throw new Error('Missing required parameter {{paramName}} when calling {{nickname}}');
|
throw new Error('Required parameter {{paramName}} was null or undefined when calling {{nickname}}.');
|
||||||
}
|
}
|
||||||
{{/required}}{{/allParams}}
|
{{/required}}{{/allParams}}
|
||||||
{{#queryParams}}
|
{{#queryParams}}
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
/**
|
||||||
|
* NOTE: This class is auto generated by the akka-scala (beta) swagger code generator program.
|
||||||
|
* https://github.com/swagger-api/swagger-codegen
|
||||||
|
* For any issue or feedback, please open a ticket via https://github.com/swagger-api/swagger-codegen/issues/new
|
||||||
|
*/
|
||||||
package {{package}}
|
package {{package}}
|
||||||
|
|
||||||
{{#imports}}
|
{{#imports}}
|
||||||
@ -29,7 +34,7 @@ object {{classname}} {
|
|||||||
{{/dataType}}{{^dataType}}.withDefault{{>responseState}}Response[Unit]
|
{{/dataType}}{{^dataType}}.withDefault{{>responseState}}Response[Unit]
|
||||||
{{/dataType}}{{/isWildcard}}{{/responses}}{{^responseHeaders.isEmpty}}
|
{{/dataType}}{{/isWildcard}}{{/responses}}{{^responseHeaders.isEmpty}}
|
||||||
object {{#fnCapitalize}}{{operationId}}{{/fnCapitalize}}Headers { {{#responseHeaders}}
|
object {{#fnCapitalize}}{{operationId}}{{/fnCapitalize}}Headers { {{#responseHeaders}}
|
||||||
def {{name}}(r: ApiReturnWithHeaders) = r.get{{^isContainer}}{{baseType}}{{/isContainer}}{{#isContainer}}String{{/isContainer}}Header("{{baseName}}"){{/responseHeaders}}
|
def {{{name}}}(r: ApiReturnWithHeaders) = r.get{{^isContainer}}{{baseType}}{{/isContainer}}{{#isContainer}}String{{/isContainer}}Header("{{baseName}}"){{/responseHeaders}}
|
||||||
}
|
}
|
||||||
{{/responseHeaders.isEmpty}}
|
{{/responseHeaders.isEmpty}}
|
||||||
{{/operation}}
|
{{/operation}}
|
||||||
@ -40,4 +45,4 @@ object {{classname}} {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{{/operations}}
|
{{/operations}}
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
/**
|
||||||
|
* NOTE: This class is auto generated by the akka-scala (beta) swagger code generator program.
|
||||||
|
* https://github.com/swagger-api/swagger-codegen
|
||||||
|
* For any issue or feedback, please open a ticket via https://github.com/swagger-api/swagger-codegen/issues/new
|
||||||
|
*/
|
||||||
|
|
||||||
package {{invokerPackage}}
|
package {{invokerPackage}}
|
||||||
|
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
/**
|
||||||
|
* NOTE: This class is auto generated by the akka-scala (beta) swagger code generator program.
|
||||||
|
* https://github.com/swagger-api/swagger-codegen
|
||||||
|
* For any issue or feedback, please open a ticket via https://github.com/swagger-api/swagger-codegen/issues/new
|
||||||
|
*/
|
||||||
package {{invokerPackage}}
|
package {{invokerPackage}}
|
||||||
|
|
||||||
sealed trait ResponseState
|
sealed trait ResponseState
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
/**
|
||||||
|
* NOTE: This class is auto generated by the akka-scala (beta) swagger code generator program.
|
||||||
|
* https://github.com/swagger-api/swagger-codegen
|
||||||
|
* For any issue or feedback, please open a ticket via https://github.com/swagger-api/swagger-codegen/issues/new
|
||||||
|
*/
|
||||||
package {{invokerPackage}}
|
package {{invokerPackage}}
|
||||||
|
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
/**
|
||||||
|
* NOTE: This class is auto generated by the akka-scala (beta) swagger code generator program.
|
||||||
|
* https://github.com/swagger-api/swagger-codegen
|
||||||
|
* For any issue or feedback, please open a ticket via https://github.com/swagger-api/swagger-codegen/issues/new
|
||||||
|
*/
|
||||||
package {{apiPackage}}
|
package {{apiPackage}}
|
||||||
|
|
||||||
import {{modelPackage}}._
|
import {{modelPackage}}._
|
||||||
@ -39,4 +44,4 @@ object EnumsSerializers {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
/**
|
||||||
|
* NOTE: This class is auto generated by the akka-scala (beta) swagger code generator program.
|
||||||
|
* https://github.com/swagger-api/swagger-codegen
|
||||||
|
* For any issue or feedback, please open a ticket via https://github.com/swagger-api/swagger-codegen/issues/new
|
||||||
|
*/
|
||||||
|
|
||||||
package {{package}}
|
package {{package}}
|
||||||
|
|
||||||
import {{invokerPackage}}.ApiModel
|
import {{invokerPackage}}.ApiModel
|
||||||
@ -8,7 +14,7 @@ import org.joda.time.DateTime
|
|||||||
|
|
||||||
case class {{classname}} (
|
case class {{classname}} (
|
||||||
{{#vars}}{{#description}}/* {{{description}}} */
|
{{#vars}}{{#description}}/* {{{description}}} */
|
||||||
{{/description}}{{name}}: {{^required}}Option[{{/required}}{{^isEnum}}{{datatype}}{{/isEnum}}{{#isEnum}}{{classname}}Enums.{{datatypeWithEnum}}{{/isEnum}}{{^required}}]{{/required}}{{#hasMore}},{{/hasMore}}{{^hasMore}}){{/hasMore}}
|
{{/description}}{{{name}}}: {{^required}}Option[{{/required}}{{^isEnum}}{{datatype}}{{/isEnum}}{{#isEnum}}{{classname}}Enums.{{datatypeWithEnum}}{{/isEnum}}{{^required}}]{{/required}}{{#hasMore}},{{/hasMore}}{{^hasMore}}){{/hasMore}}
|
||||||
{{/vars}} extends ApiModel
|
{{/vars}} extends ApiModel
|
||||||
|
|
||||||
{{#hasEnums}}
|
{{#hasEnums}}
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
/**
|
||||||
|
* NOTE: This class is auto generated by the akka-scala (beta) swagger code generator program.
|
||||||
|
* https://github.com/swagger-api/swagger-codegen
|
||||||
|
* For any issue or feedback, please open a ticket via https://github.com/swagger-api/swagger-codegen/issues/new
|
||||||
|
*/
|
||||||
package {{invokerPackage}}
|
package {{invokerPackage}}
|
||||||
|
|
||||||
import java.io.File
|
import java.io.File
|
||||||
@ -8,6 +13,8 @@ sealed trait ApiReturnWithHeaders {
|
|||||||
def headers: Map[String, String]
|
def headers: Map[String, String]
|
||||||
def header(name: String): Option[String] = headers.get(name)
|
def header(name: String): Option[String] = headers.get(name)
|
||||||
def getStringHeader(name: String) = header(name)
|
def getStringHeader(name: String) = header(name)
|
||||||
|
// workaround: return date time header in string instead of datetime object
|
||||||
|
def getDateTimeHeader(name: String) = header(name)
|
||||||
def getIntHeader(name: String) = castedHeader(name, java.lang.Integer.parseInt)
|
def getIntHeader(name: String) = castedHeader(name, java.lang.Integer.parseInt)
|
||||||
def getLongHeader(name: String) = castedHeader(name, java.lang.Long.parseLong)
|
def getLongHeader(name: String) = castedHeader(name, java.lang.Long.parseLong)
|
||||||
def getFloatHeader(name: String) = castedHeader(name, java.lang.Float.parseFloat)
|
def getFloatHeader(name: String) = castedHeader(name, java.lang.Float.parseFloat)
|
||||||
|
@ -121,7 +121,10 @@ public class {{classname}} {
|
|||||||
throw ex;
|
throw ex;
|
||||||
} catch (ExecutionException ex) {
|
} catch (ExecutionException ex) {
|
||||||
if(ex.getCause() instanceof VolleyError) {
|
if(ex.getCause() instanceof VolleyError) {
|
||||||
throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage());
|
VolleyError volleyError = (VolleyError)ex.getCause();
|
||||||
|
if (volleyError.networkResponse != null) {
|
||||||
|
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
throw ex;
|
throw ex;
|
||||||
} catch (TimeoutException ex) {
|
} catch (TimeoutException ex) {
|
||||||
|
@ -70,7 +70,7 @@ ext {
|
|||||||
dependencies {
|
dependencies {
|
||||||
compile "io.swagger:swagger-annotations:$swagger_annotations_version"
|
compile "io.swagger:swagger-annotations:$swagger_annotations_version"
|
||||||
compile "com.google.code.gson:gson:$gson_version"
|
compile "com.google.code.gson:gson:$gson_version"
|
||||||
compile "org.apache.httpcomponents:httpcore:$httpclient_version"
|
compile "org.apache.httpcomponents:httpcore:$httpcore_version"
|
||||||
compile "org.apache.httpcomponents:httpmime:$httpclient_version"
|
compile "org.apache.httpcomponents:httpmime:$httpclient_version"
|
||||||
compile "com.mcxiaoke.volley:library:${volley_version}@aar"
|
compile "com.mcxiaoke.volley:library:${volley_version}@aar"
|
||||||
testCompile "junit:junit:$junit_version"
|
testCompile "junit:junit:$junit_version"
|
||||||
|
@ -10,7 +10,7 @@ import collection.mutable
|
|||||||
class {{classname}}(client: TransportClient, config: SwaggerConfig) extends ApiClient(client, config) {
|
class {{classname}}(client: TransportClient, config: SwaggerConfig) extends ApiClient(client, config) {
|
||||||
|
|
||||||
{{#operation}}
|
{{#operation}}
|
||||||
def {{nickname}}({{#allParams}}{{^required}}{{paramName}}: Option[{{dataType}}] = {{#defaultValue}}Some({{defaultValue}}){{/defaultValue}}{{^defaultValue}}None{{/defaultValue}}{{#hasMore}},{{/hasMore}}
|
def {{operationId}}({{#allParams}}{{^required}}{{paramName}}: Option[{{dataType}}] = {{#defaultValue}}Some({{defaultValue}}){{/defaultValue}}{{^defaultValue}}None{{/defaultValue}}{{#hasMore}},{{/hasMore}}
|
||||||
{{/required}}{{#required}}{{paramName}}: {{dataType}}{{#defaultValue}} = {{{defaultValue}}}{{/defaultValue}}{{#hasMore}},
|
{{/required}}{{#required}}{{paramName}}: {{dataType}}{{#defaultValue}} = {{{defaultValue}}}{{/defaultValue}}{{#hasMore}},
|
||||||
{{/hasMore}}{{/required}}{{/allParams}})(implicit reader: ClientResponseReader[{{#returnType}}{{returnType}}{{/returnType}}{{^returnType}}Unit{{/returnType}}]{{#bodyParams}}, writer: RequestWriter[{{dataType}}]{{/bodyParams}}){{#returnType}}: Future[{{returnType}}]{{/returnType}}{{^returnType}}: Future[Unit]{{/returnType}} = {
|
{{/hasMore}}{{/required}}{{/allParams}})(implicit reader: ClientResponseReader[{{#returnType}}{{returnType}}{{/returnType}}{{^returnType}}Unit{{/returnType}}]{{#bodyParams}}, writer: RequestWriter[{{dataType}}]{{/bodyParams}}){{#returnType}}: Future[{{returnType}}]{{/returnType}}{{^returnType}}: Future[Unit]{{/returnType}} = {
|
||||||
// create path and map variables
|
// create path and map variables
|
||||||
@ -21,14 +21,28 @@ class {{classname}}(client: TransportClient, config: SwaggerConfig) extends ApiC
|
|||||||
val queryParams = new mutable.HashMap[String, String]
|
val queryParams = new mutable.HashMap[String, String]
|
||||||
val headerParams = new mutable.HashMap[String, String]
|
val headerParams = new mutable.HashMap[String, String]
|
||||||
|
|
||||||
{{#requiredParamCount}}// verify required params are set
|
{{#allParams}}
|
||||||
val paramCount = (Set[Any]({{/requiredParamCount}}{{#requiredParams}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/requiredParams}}{{#requiredParamCount}}) - null).size
|
{{#required}}
|
||||||
if (paramCount != {{requiredParamCount}}) sys.error("missing required params"){{/requiredParamCount}}
|
{{^isPrimitiveType}}
|
||||||
|
if ({{paramName}} == null) throw new Exception("Missing required parameter '{{paramName}}' when calling {{classname}}->{{operationId}}")
|
||||||
|
|
||||||
{{#queryParams}}{{^required}}if({{paramName}} != null) {{paramName}}.foreach { v => queryParams += "{{baseName}}" -> v.toString }{{/required}}{{#required}}
|
{{/isPrimitiveType}}
|
||||||
if({{paramName}} != null) queryParams += "{{baseName}}" -> {{paramName}}.toString{{/required}}{{/queryParams}}
|
{{/required}}
|
||||||
|
{{/allParams}}
|
||||||
|
{{#queryParams}}
|
||||||
|
{{^required}}
|
||||||
|
if ({{paramName}} != null) {{paramName}}.foreach { v => queryParams += "{{baseName}}" -> v.toString }
|
||||||
|
|
||||||
{{#headerParams}}headerParams += "{{baseName}}" -> {{paramName}}.toString{{/headerParams}}
|
{{/required}}
|
||||||
|
{{#required}}
|
||||||
|
if ({{paramName}} != null) queryParams += "{{baseName}}" -> {{paramName}}.toString
|
||||||
|
|
||||||
|
{{/required}}
|
||||||
|
{{/queryParams}}
|
||||||
|
|
||||||
|
{{#headerParams}}
|
||||||
|
headerParams += "{{baseName}}" -> {{paramName}}.toString
|
||||||
|
{{/headerParams}}
|
||||||
|
|
||||||
val resFuture = client.submit("{{httpMethod}}", path, queryParams.toMap, headerParams.toMap, {{#bodyParam}}writer.write({{paramName}}){{/bodyParam}}{{^bodyParam}}"{{emptyBodyParam}}"{{/bodyParam}})
|
val resFuture = client.submit("{{httpMethod}}", path, queryParams.toMap, headerParams.toMap, {{#bodyParam}}writer.write({{paramName}}){{/bodyParam}}{{^bodyParam}}"{{emptyBodyParam}}"{{/bodyParam}})
|
||||||
resFuture flatMap { resp =>
|
resFuture flatMap { resp =>
|
||||||
|
@ -7,7 +7,7 @@ import java.util.UUID
|
|||||||
|
|
||||||
{{#model}}
|
{{#model}}
|
||||||
case class {{classname}} (
|
case class {{classname}} (
|
||||||
{{#vars}}{{name}}: {{#isNotRequired}}Option[{{/isNotRequired}}{{datatype}}{{#isNotRequired}}]{{/isNotRequired}}{{#hasMore}},{{/hasMore}}{{#description}} // {{description}}{{/description}}
|
{{#vars}}{{name}}: {{^required}}Option[{{/required}}{{datatype}}{{^required}}]{{/required}}{{#hasMore}},{{/hasMore}}{{#description}} // {{description}}{{/description}}
|
||||||
{{/vars}}
|
{{/vars}}
|
||||||
)
|
)
|
||||||
{{/model}}
|
{{/model}}
|
||||||
|
@ -4,7 +4,9 @@ using System.Collections.Generic;
|
|||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
{{^supportsUWP}}
|
||||||
using System.Web;
|
using System.Web;
|
||||||
|
{{/supportsUWP}}
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@ -103,7 +105,16 @@ namespace {{packageName}}.Client
|
|||||||
|
|
||||||
// add file parameter, if any
|
// add file parameter, if any
|
||||||
foreach(var param in fileParams)
|
foreach(var param in fileParams)
|
||||||
|
{
|
||||||
|
{{^supportsUWP}}
|
||||||
request.AddFile(param.Value.Name, param.Value.Writer, param.Value.FileName, param.Value.ContentType);
|
request.AddFile(param.Value.Name, param.Value.Writer, param.Value.FileName, param.Value.ContentType);
|
||||||
|
{{/supportsUWP}}
|
||||||
|
{{#supportsUWP}}
|
||||||
|
byte[] paramWriter = null;
|
||||||
|
param.Value.Writer = delegate (Stream stream) { paramWriter = ToByteArray(stream); };
|
||||||
|
request.AddFile(param.Value.Name, paramWriter, param.Value.FileName, param.Value.ContentType);
|
||||||
|
{{/supportsUWP}}
|
||||||
|
}
|
||||||
|
|
||||||
if (postBody != null) // http body (model or byte[]) parameter
|
if (postBody != null) // http body (model or byte[]) parameter
|
||||||
{
|
{
|
||||||
@ -148,7 +159,13 @@ namespace {{packageName}}.Client
|
|||||||
// set user agent
|
// set user agent
|
||||||
RestClient.UserAgent = Configuration.UserAgent;
|
RestClient.UserAgent = Configuration.UserAgent;
|
||||||
|
|
||||||
|
{{^supportsUWP}}
|
||||||
var response = RestClient.Execute(request);
|
var response = RestClient.Execute(request);
|
||||||
|
{{/supportsUWP}}
|
||||||
|
{{#supportsUWP}}
|
||||||
|
// Using async method to perform sync call (uwp-only)
|
||||||
|
var response = RestClient.ExecuteTaskAsync(request).Result;
|
||||||
|
{{/supportsUWP}}
|
||||||
return (Object) response;
|
return (Object) response;
|
||||||
}
|
}
|
||||||
{{#supportsAsync}}
|
{{#supportsAsync}}
|
||||||
@ -444,5 +461,20 @@ namespace {{packageName}}.Client
|
|||||||
return filename;
|
return filename;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
{{#supportsUWP}}
|
||||||
|
/// <summary>
|
||||||
|
/// Convert stream to byte array
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="stream">IO stream</param>
|
||||||
|
/// <returns>Byte array</returns>
|
||||||
|
public static byte[] ToByteArray(Stream stream)
|
||||||
|
{
|
||||||
|
stream.Position = 0;
|
||||||
|
byte[] buffer = new byte[stream.Length];
|
||||||
|
for (int totalBytesCopied = 0; totalBytesCopied < stream.Length;)
|
||||||
|
totalBytesCopied += stream.Read(buffer, totalBytesCopied, Convert.ToInt32(stream.Length) - totalBytesCopied);
|
||||||
|
return buffer;
|
||||||
|
}
|
||||||
|
{{/supportsUWP}}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -270,11 +270,13 @@ namespace {{packageName}}.Client
|
|||||||
public static String ToDebugReport()
|
public static String ToDebugReport()
|
||||||
{
|
{
|
||||||
String report = "C# SDK ({{packageName}}) Debug Report:\n";
|
String report = "C# SDK ({{packageName}}) Debug Report:\n";
|
||||||
|
{{^supportsUWP}}
|
||||||
report += " OS: " + Environment.OSVersion + "\n";
|
report += " OS: " + Environment.OSVersion + "\n";
|
||||||
report += " .NET Framework Version: " + Assembly
|
report += " .NET Framework Version: " + Assembly
|
||||||
.GetExecutingAssembly()
|
.GetExecutingAssembly()
|
||||||
.GetReferencedAssemblies()
|
.GetReferencedAssemblies()
|
||||||
.Where(x => x.Name == "System.Core").First().Version.ToString() + "\n";
|
.Where(x => x.Name == "System.Core").First().Version.ToString() + "\n";
|
||||||
|
{{/supportsUWP}}
|
||||||
report += " Version of the API: {{version}}\n";
|
report += " Version of the API: {{version}}\n";
|
||||||
report += " SDK Package Version: {{packageVersion}}\n";
|
report += " SDK Package Version: {{packageVersion}}\n";
|
||||||
|
|
||||||
|
@ -8,7 +8,15 @@
|
|||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
<RootNamespace>{{packageTitle}}</RootNamespace>
|
<RootNamespace>{{packageTitle}}</RootNamespace>
|
||||||
<AssemblyName>{{packageTitle}}</AssemblyName>
|
<AssemblyName>{{packageTitle}}</AssemblyName>
|
||||||
|
{{^supportsUWP}}
|
||||||
<TargetFrameworkVersion>{{targetFramework}}</TargetFrameworkVersion>
|
<TargetFrameworkVersion>{{targetFramework}}</TargetFrameworkVersion>
|
||||||
|
{{/supportsUWP}}
|
||||||
|
{{#supportsUWP}}
|
||||||
|
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
|
||||||
|
<TargetPlatformVersion>10.0.10240.0</TargetPlatformVersion>
|
||||||
|
<TargetPlatformMinVersion>10.0.10240.0</TargetPlatformMinVersion>
|
||||||
|
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
|
||||||
|
{{/supportsUWP}}
|
||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
@ -1,22 +0,0 @@
|
|||||||
## Frameworks supported
|
|
||||||
- .NET 4.0 or later
|
|
||||||
- Windows Phone 7.1 (Mango)
|
|
||||||
|
|
||||||
## Dependencies
|
|
||||||
- [RestSharp] (https://www.nuget.org/packages/RestSharp) - 105.1.0 or later
|
|
||||||
- [Json.NET] (https://www.nuget.org/packages/Newtonsoft.Json/) - 7.0.0 or later
|
|
||||||
|
|
||||||
The DLLs included in the package may not be the latest version. We recommned using [NuGet] (https://docs.nuget.org/consume/installing-nuget) to obtain the latest version of the packages:
|
|
||||||
```
|
|
||||||
Install-Package RestSharp
|
|
||||||
Install-Package Newtonsoft.Json
|
|
||||||
```
|
|
||||||
|
|
||||||
NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See [RestSharp#742](https://github.com/restsharp/RestSharp/issues/742)
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
Run the following command to generate the DLL
|
|
||||||
- [Mac/Linux] compile-mono.sh
|
|
||||||
- [Windows] compile.bat
|
|
||||||
|
|
||||||
Then include the DLL (under the `bin` folder) in the C# project
|
|
@ -0,0 +1,147 @@
|
|||||||
|
# {{packageName}} - the C# library for the {{appName}}
|
||||||
|
|
||||||
|
{{#appDescription}}
|
||||||
|
{{{appDescription}}}
|
||||||
|
{{/appDescription}}
|
||||||
|
|
||||||
|
This C# SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
|
||||||
|
|
||||||
|
- API version: {{appVersion}}
|
||||||
|
- SDK version: {{packageVersion}}
|
||||||
|
- Build date: {{generatedDate}}
|
||||||
|
- Build package: {{generatorClass}}
|
||||||
|
{{#infoUrl}}
|
||||||
|
For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}})
|
||||||
|
{{/infoUrl}}
|
||||||
|
|
||||||
|
## Frameworks supported
|
||||||
|
{{^supportUWP}}
|
||||||
|
- .NET 4.0 or later
|
||||||
|
- Windows Phone 7.1 (Mango)
|
||||||
|
{{/supportUWP}}
|
||||||
|
{{#supportUWP}}
|
||||||
|
- UWP
|
||||||
|
{{/supportUWP}}
|
||||||
|
|
||||||
|
## Dependencies
|
||||||
|
- [RestSharp] (https://www.nuget.org/packages/RestSharp) - 105.1.0 or later
|
||||||
|
- [Json.NET] (https://www.nuget.org/packages/Newtonsoft.Json/) - 7.0.0 or later
|
||||||
|
|
||||||
|
The DLLs included in the package may not be the latest version. We recommned using [NuGet] (https://docs.nuget.org/consume/installing-nuget) to obtain the latest version of the packages:
|
||||||
|
```
|
||||||
|
Install-Package RestSharp
|
||||||
|
Install-Package Newtonsoft.Json
|
||||||
|
```
|
||||||
|
|
||||||
|
NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See [RestSharp#742](https://github.com/restsharp/RestSharp/issues/742)
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
Run the following command to generate the DLL
|
||||||
|
- [Mac/Linux] `/bin/sh compile-mono.sh`
|
||||||
|
- [Windows] `compile.bat`
|
||||||
|
|
||||||
|
Then include the DLL (under the `bin` folder) in the C# project, and use the namespaces:
|
||||||
|
```csharp
|
||||||
|
using {{packageName}}.Api;
|
||||||
|
using {{packageName}}.Client;
|
||||||
|
{{#modelPackage}}
|
||||||
|
using {{{.}}};
|
||||||
|
{{/modelPackage}}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Getting Started
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using {{packageName}}.Api;
|
||||||
|
using {{packageName}}.Client;
|
||||||
|
{{#modelPackage}}
|
||||||
|
using {{{.}}};
|
||||||
|
{{/modelPackage}}
|
||||||
|
|
||||||
|
namespace Example
|
||||||
|
{
|
||||||
|
public class {{operationId}}Example
|
||||||
|
{
|
||||||
|
public void main()
|
||||||
|
{
|
||||||
|
{{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}}{{#hasAuthMethods}}{{#authMethods}}{{#isBasic}}
|
||||||
|
// Configure HTTP basic authorization: {{{name}}}
|
||||||
|
Configuration.Default.Username = 'YOUR_USERNAME';
|
||||||
|
Configuration.Default.Password = 'YOUR_PASSWORD';{{/isBasic}}{{#isApiKey}}
|
||||||
|
// Configure API key authorization: {{{name}}}
|
||||||
|
Configuration.Default.ApiKey.Add('{{{keyParamName}}}', 'YOUR_API_KEY');
|
||||||
|
// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed
|
||||||
|
// Configuration.Default.ApiKeyPrefix.Add('{{{keyParamName}}}', 'BEARER');{{/isApiKey}}{{#isOAuth}}
|
||||||
|
// Configure OAuth2 access token for authorization: {{{name}}}
|
||||||
|
Configuration.Default.AccessToken = 'YOUR_ACCESS_TOKEN';{{/isOAuth}}{{/authMethods}}
|
||||||
|
{{/hasAuthMethods}}
|
||||||
|
|
||||||
|
var apiInstance = new {{classname}}();
|
||||||
|
{{#allParams}}
|
||||||
|
{{#isPrimitiveType}}
|
||||||
|
var {{paramName}} = {{example}}; // {{{dataType}}} | {{{description}}}{{^required}} (optional) {{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}}
|
||||||
|
{{/isPrimitiveType}}
|
||||||
|
{{^isPrimitiveType}}
|
||||||
|
var {{paramName}} = new {{{dataType}}}(); // {{{dataType}}} | {{{description}}}{{^required}} (optional) {{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}}
|
||||||
|
{{/isPrimitiveType}}
|
||||||
|
{{/allParams}}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
{{#summary}}
|
||||||
|
// {{{.}}}
|
||||||
|
{{/summary}}
|
||||||
|
{{#returnType}}{{{.}}} result = {{/returnType}}apiInstance.{{{operationId}}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{#returnType}}
|
||||||
|
Debug.WriteLine(result);{{/returnType}}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Debug.Print("Exception when calling {{classname}}.{{operationId}}: " + e.Message );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}{{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Documentation for API Endpoints
|
||||||
|
|
||||||
|
All URIs are relative to *{{basePath}}*
|
||||||
|
|
||||||
|
Class | Method | HTTP request | Description
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{{summary}}}{{/summary}}
|
||||||
|
{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}
|
||||||
|
|
||||||
|
## Documentation for Models
|
||||||
|
|
||||||
|
{{#modelPackage}}
|
||||||
|
{{#models}}{{#model}} - [{{{modelPackage}}}.{{{classname}}}]({{modelDocPath}}{{{classname}}}.md)
|
||||||
|
{{/model}}{{/models}}
|
||||||
|
{{/modelPackage}}
|
||||||
|
{{^modelPackage}}
|
||||||
|
No model defined in this package
|
||||||
|
{{/modelPackage}}
|
||||||
|
|
||||||
|
## Documentation for Authorization
|
||||||
|
|
||||||
|
{{^authMethods}} All endpoints do not require authorization.
|
||||||
|
{{/authMethods}}{{#authMethods}}{{#last}} Authentication schemes defined for the API:{{/last}}{{/authMethods}}
|
||||||
|
{{#authMethods}}### {{name}}
|
||||||
|
|
||||||
|
{{#isApiKey}}- **Type**: API key
|
||||||
|
- **API key parameter name**: {{keyParamName}}
|
||||||
|
- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}}
|
||||||
|
{{/isApiKey}}
|
||||||
|
{{#isBasic}}- **Type**: HTTP basic authentication
|
||||||
|
{{/isBasic}}
|
||||||
|
{{#isOAuth}}- **Type**: OAuth
|
||||||
|
- **Flow**: {{flow}}
|
||||||
|
- **Authorization URL**: {{authorizationUrl}}
|
||||||
|
- **Scopes**: {{^scopes}}N/A{{/scopes}}
|
||||||
|
{{#scopes}} - {{scope}}: {{description}}
|
||||||
|
{{/scopes}}
|
||||||
|
{{/isOAuth}}
|
||||||
|
|
||||||
|
{{/authMethods}}
|
@ -1,5 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.IO;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@ -178,14 +177,15 @@ namespace {{packageName}}.Api
|
|||||||
{{/allParams}}/// <returns>ApiResponse of {{#returnType}}{{returnType}}{{/returnType}}{{^returnType}}Object(void){{/returnType}}</returns>
|
{{/allParams}}/// <returns>ApiResponse of {{#returnType}}{{returnType}}{{/returnType}}{{^returnType}}Object(void){{/returnType}}</returns>
|
||||||
public ApiResponse<{{#returnType}} {{{returnType}}} {{/returnType}}{{^returnType}}Object{{/returnType}}> {{operationId}}WithHttpInfo ({{#allParams}}{{{dataType}}} {{paramName}}{{^required}}{{#optionalMethodArgument}} = null{{/optionalMethodArgument}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}})
|
public ApiResponse<{{#returnType}} {{{returnType}}} {{/returnType}}{{^returnType}}Object{{/returnType}}> {{operationId}}WithHttpInfo ({{#allParams}}{{{dataType}}} {{paramName}}{{^required}}{{#optionalMethodArgument}} = null{{/optionalMethodArgument}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}})
|
||||||
{
|
{
|
||||||
{{#allParams}}{{#required}}
|
{{#allParams}}
|
||||||
|
{{#required}}
|
||||||
// verify the required parameter '{{paramName}}' is set
|
// verify the required parameter '{{paramName}}' is set
|
||||||
if ({{paramName}} == null)
|
if ({{paramName}} == null)
|
||||||
throw new ApiException(400, "Missing required parameter '{{paramName}}' when calling {{classname}}->{{operationId}}");
|
throw new ApiException(400, "Missing required parameter '{{paramName}}' when calling {{classname}}->{{operationId}}");
|
||||||
{{/required}}{{/allParams}}
|
{{/required}}
|
||||||
|
{{/allParams}}
|
||||||
|
|
||||||
var localVarPath = "{{path}}";
|
var localVarPath = "{{path}}";
|
||||||
|
|
||||||
var localVarPathParams = new Dictionary<String, String>();
|
var localVarPathParams = new Dictionary<String, String>();
|
||||||
var localVarQueryParams = new Dictionary<String, String>();
|
var localVarQueryParams = new Dictionary<String, String>();
|
||||||
var localVarHeaderParams = new Dictionary<String, String>(Configuration.DefaultHeader);
|
var localVarHeaderParams = new Dictionary<String, String>(Configuration.DefaultHeader);
|
||||||
@ -195,13 +195,17 @@ namespace {{packageName}}.Api
|
|||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
String[] localVarHttpContentTypes = new String[] {
|
String[] localVarHttpContentTypes = new String[] {
|
||||||
{{#consumes}}"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/consumes}}
|
{{#consumes}}
|
||||||
|
"{{mediaType}}"{{#hasMore}}, {{/hasMore}}
|
||||||
|
{{/consumes}}
|
||||||
};
|
};
|
||||||
String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);
|
String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);
|
||||||
|
|
||||||
// to determine the Accept header
|
// to determine the Accept header
|
||||||
String[] localVarHttpHeaderAccepts = new String[] {
|
String[] localVarHttpHeaderAccepts = new String[] {
|
||||||
{{#produces}}"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/produces}}
|
{{#produces}}
|
||||||
|
"{{mediaType}}"{{#hasMore}}, {{/hasMore}}
|
||||||
|
{{/produces}}
|
||||||
};
|
};
|
||||||
String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
|
String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
|
||||||
if (localVarHttpHeaderAccept != null)
|
if (localVarHttpHeaderAccept != null)
|
||||||
@ -210,38 +214,53 @@ namespace {{packageName}}.Api
|
|||||||
// set "format" to json by default
|
// set "format" to json by default
|
||||||
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
|
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
|
||||||
localVarPathParams.Add("format", "json");
|
localVarPathParams.Add("format", "json");
|
||||||
{{#pathParams}}if ({{paramName}} != null) localVarPathParams.Add("{{baseName}}", Configuration.ApiClient.ParameterToString({{paramName}})); // path parameter
|
{{#pathParams}}
|
||||||
|
if ({{paramName}} != null) localVarPathParams.Add("{{baseName}}", Configuration.ApiClient.ParameterToString({{paramName}})); // path parameter
|
||||||
{{/pathParams}}
|
{{/pathParams}}
|
||||||
{{#queryParams}}if ({{paramName}} != null) localVarQueryParams.Add("{{baseName}}", Configuration.ApiClient.ParameterToString({{paramName}})); // query parameter
|
{{#queryParams}}
|
||||||
|
if ({{paramName}} != null) localVarQueryParams.Add("{{baseName}}", Configuration.ApiClient.ParameterToString({{paramName}})); // query parameter
|
||||||
{{/queryParams}}
|
{{/queryParams}}
|
||||||
{{#headerParams}}if ({{paramName}} != null) localVarHeaderParams.Add("{{baseName}}", Configuration.ApiClient.ParameterToString({{paramName}})); // header parameter
|
{{#headerParams}}
|
||||||
|
if ({{paramName}} != null) localVarHeaderParams.Add("{{baseName}}", Configuration.ApiClient.ParameterToString({{paramName}})); // header parameter
|
||||||
{{/headerParams}}
|
{{/headerParams}}
|
||||||
{{#formParams}}if ({{paramName}} != null) {{#isFile}}localVarFileParams.Add("{{baseName}}", Configuration.ApiClient.ParameterToFile("{{baseName}}", {{paramName}}));{{/isFile}}{{^isFile}}localVarFormParams.Add("{{baseName}}", Configuration.ApiClient.ParameterToString({{paramName}})); // form parameter{{/isFile}}
|
{{#formParams}}
|
||||||
|
if ({{paramName}} != null) {{#isFile}}localVarFileParams.Add("{{baseName}}", Configuration.ApiClient.ParameterToFile("{{baseName}}", {{paramName}}));{{/isFile}}{{^isFile}}localVarFormParams.Add("{{baseName}}", Configuration.ApiClient.ParameterToString({{paramName}})); // form parameter{{/isFile}}
|
||||||
{{/formParams}}
|
{{/formParams}}
|
||||||
{{#bodyParam}}if ({{paramName}}.GetType() != typeof(byte[]))
|
{{#bodyParam}}
|
||||||
|
if ({{paramName}}.GetType() != typeof(byte[]))
|
||||||
{
|
{
|
||||||
localVarPostBody = Configuration.ApiClient.Serialize({{paramName}}); // http body (model) parameter
|
localVarPostBody = Configuration.ApiClient.Serialize({{paramName}}); // http body (model) parameter
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
localVarPostBody = {{paramName}}; // byte array
|
localVarPostBody = {{paramName}}; // byte array
|
||||||
}{{/bodyParam}}
|
}
|
||||||
|
{{/bodyParam}}
|
||||||
|
|
||||||
{{#authMethods}}// authentication ({{name}}) required
|
{{#authMethods}}
|
||||||
{{#isApiKey}}{{#isKeyInHeader}}
|
// authentication ({{name}}) required
|
||||||
|
{{#isApiKey}}
|
||||||
|
{{#isKeyInHeader}}
|
||||||
if (!String.IsNullOrEmpty(Configuration.GetApiKeyWithPrefix("{{keyParamName}}")))
|
if (!String.IsNullOrEmpty(Configuration.GetApiKeyWithPrefix("{{keyParamName}}")))
|
||||||
{
|
{
|
||||||
localVarHeaderParams["{{keyParamName}}"] = Configuration.GetApiKeyWithPrefix("{{keyParamName}}");
|
localVarHeaderParams["{{keyParamName}}"] = Configuration.GetApiKeyWithPrefix("{{keyParamName}}");
|
||||||
}{{/isKeyInHeader}}{{#isKeyInQuery}}
|
}
|
||||||
|
{{/isKeyInHeader}}
|
||||||
|
{{#isKeyInQuery}}
|
||||||
if (!String.IsNullOrEmpty(Configuration.GetApiKeyWithPrefix("{{keyParamName}}")))
|
if (!String.IsNullOrEmpty(Configuration.GetApiKeyWithPrefix("{{keyParamName}}")))
|
||||||
{
|
{
|
||||||
localVarQueryParams["{{keyParamName}}"] = Configuration.GetApiKeyWithPrefix("{{keyParamName}}");
|
localVarQueryParams["{{keyParamName}}"] = Configuration.GetApiKeyWithPrefix("{{keyParamName}}");
|
||||||
}{{/isKeyInQuery}}{{/isApiKey}}{{#isBasic}}
|
}
|
||||||
|
{{/isKeyInQuery}}
|
||||||
|
{{/isApiKey}}
|
||||||
|
{{#isBasic}}
|
||||||
// http basic authentication required
|
// http basic authentication required
|
||||||
if (!String.IsNullOrEmpty(Configuration.Username) || !String.IsNullOrEmpty(Configuration.Password))
|
if (!String.IsNullOrEmpty(Configuration.Username) || !String.IsNullOrEmpty(Configuration.Password))
|
||||||
{
|
{
|
||||||
localVarHeaderParams["Authorization"] = "Basic " + ApiClient.Base64Encode(Configuration.Username + ":" + Configuration.Password);
|
localVarHeaderParams["Authorization"] = "Basic " + ApiClient.Base64Encode(Configuration.Username + ":" + Configuration.Password);
|
||||||
}{{/isBasic}}{{#isOAuth}}
|
}
|
||||||
|
{{/isBasic}}
|
||||||
|
{{#isOAuth}}
|
||||||
// oauth required
|
// oauth required
|
||||||
if (!String.IsNullOrEmpty(Configuration.AccessToken))
|
if (!String.IsNullOrEmpty(Configuration.AccessToken))
|
||||||
{
|
{
|
||||||
@ -291,12 +310,15 @@ namespace {{packageName}}.Api
|
|||||||
{{/allParams}}/// <returns>Task of ApiResponse{{#returnType}} ({{returnType}}){{/returnType}}</returns>
|
{{/allParams}}/// <returns>Task of ApiResponse{{#returnType}} ({{returnType}}){{/returnType}}</returns>
|
||||||
public async System.Threading.Tasks.Task<ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Object{{/returnType}}>> {{operationId}}AsyncWithHttpInfo ({{#allParams}}{{{dataType}}} {{paramName}}{{^required}}{{#optionalMethodArgument}} = null{{/optionalMethodArgument}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}})
|
public async System.Threading.Tasks.Task<ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Object{{/returnType}}>> {{operationId}}AsyncWithHttpInfo ({{#allParams}}{{{dataType}}} {{paramName}}{{^required}}{{#optionalMethodArgument}} = null{{/optionalMethodArgument}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}})
|
||||||
{
|
{
|
||||||
{{#allParams}}{{#required}}// verify the required parameter '{{paramName}}' is set
|
{{#allParams}}
|
||||||
if ({{paramName}} == null) throw new ApiException(400, "Missing required parameter '{{paramName}}' when calling {{operationId}}");
|
{{#required}}
|
||||||
{{/required}}{{/allParams}}
|
// verify the required parameter '{{paramName}}' is set
|
||||||
|
if ({{paramName}} == null)
|
||||||
|
throw new ApiException(400, "Missing required parameter '{{paramName}}' when calling {{classname}}->{{operationId}}");
|
||||||
|
{{/required}}
|
||||||
|
{{/allParams}}
|
||||||
|
|
||||||
var localVarPath = "{{path}}";
|
var localVarPath = "{{path}}";
|
||||||
|
|
||||||
var localVarPathParams = new Dictionary<String, String>();
|
var localVarPathParams = new Dictionary<String, String>();
|
||||||
var localVarQueryParams = new Dictionary<String, String>();
|
var localVarQueryParams = new Dictionary<String, String>();
|
||||||
var localVarHeaderParams = new Dictionary<String, String>(Configuration.DefaultHeader);
|
var localVarHeaderParams = new Dictionary<String, String>(Configuration.DefaultHeader);
|
||||||
@ -306,13 +328,17 @@ namespace {{packageName}}.Api
|
|||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
String[] localVarHttpContentTypes = new String[] {
|
String[] localVarHttpContentTypes = new String[] {
|
||||||
{{#consumes}}"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/consumes}}
|
{{#consumes}}
|
||||||
|
"{{mediaType}}"{{#hasMore}}, {{/hasMore}}
|
||||||
|
{{/consumes}}
|
||||||
};
|
};
|
||||||
String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);
|
String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);
|
||||||
|
|
||||||
// to determine the Accept header
|
// to determine the Accept header
|
||||||
String[] localVarHttpHeaderAccepts = new String[] {
|
String[] localVarHttpHeaderAccepts = new String[] {
|
||||||
{{#produces}}"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/produces}}
|
{{#produces}}
|
||||||
|
"{{mediaType}}"{{#hasMore}}, {{/hasMore}}
|
||||||
|
{{/produces}}
|
||||||
};
|
};
|
||||||
String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
|
String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
|
||||||
if (localVarHttpHeaderAccept != null)
|
if (localVarHttpHeaderAccept != null)
|
||||||
@ -321,44 +347,59 @@ namespace {{packageName}}.Api
|
|||||||
// set "format" to json by default
|
// set "format" to json by default
|
||||||
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
|
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
|
||||||
localVarPathParams.Add("format", "json");
|
localVarPathParams.Add("format", "json");
|
||||||
{{#pathParams}}if ({{paramName}} != null) localVarPathParams.Add("{{baseName}}", Configuration.ApiClient.ParameterToString({{paramName}})); // path parameter
|
{{#pathParams}}
|
||||||
|
if ({{paramName}} != null) localVarPathParams.Add("{{baseName}}", Configuration.ApiClient.ParameterToString({{paramName}})); // path parameter
|
||||||
{{/pathParams}}
|
{{/pathParams}}
|
||||||
{{#queryParams}}if ({{paramName}} != null) localVarQueryParams.Add("{{baseName}}", Configuration.ApiClient.ParameterToString({{paramName}})); // query parameter
|
{{#queryParams}}
|
||||||
|
if ({{paramName}} != null) localVarQueryParams.Add("{{baseName}}", Configuration.ApiClient.ParameterToString({{paramName}})); // query parameter
|
||||||
{{/queryParams}}
|
{{/queryParams}}
|
||||||
{{#headerParams}}if ({{paramName}} != null) localVarHeaderParams.Add("{{baseName}}", Configuration.ApiClient.ParameterToString({{paramName}})); // header parameter
|
{{#headerParams}}
|
||||||
|
if ({{paramName}} != null) localVarHeaderParams.Add("{{baseName}}", Configuration.ApiClient.ParameterToString({{paramName}})); // header parameter
|
||||||
{{/headerParams}}
|
{{/headerParams}}
|
||||||
{{#formParams}}if ({{paramName}} != null) {{#isFile}}localVarFileParams.Add("{{baseName}}", Configuration.ApiClient.ParameterToFile("{{baseName}}", {{paramName}}));{{/isFile}}{{^isFile}}localVarFormParams.Add("{{baseName}}", Configuration.ApiClient.ParameterToString({{paramName}})); // form parameter{{/isFile}}
|
{{#formParams}}
|
||||||
|
if ({{paramName}} != null) {{#isFile}}localVarFileParams.Add("{{baseName}}", Configuration.ApiClient.ParameterToFile("{{baseName}}", {{paramName}}));{{/isFile}}{{^isFile}}localVarFormParams.Add("{{baseName}}", Configuration.ApiClient.ParameterToString({{paramName}})); // form parameter{{/isFile}}
|
||||||
{{/formParams}}
|
{{/formParams}}
|
||||||
{{#bodyParam}}if ({{paramName}}.GetType() != typeof(byte[]))
|
{{#bodyParam}}
|
||||||
|
if ({{paramName}}.GetType() != typeof(byte[]))
|
||||||
{
|
{
|
||||||
localVarPostBody = Configuration.ApiClient.Serialize({{paramName}}); // http body (model) parameter
|
localVarPostBody = Configuration.ApiClient.Serialize({{paramName}}); // http body (model) parameter
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
localVarPostBody = {{paramName}}; // byte array
|
localVarPostBody = {{paramName}}; // byte array
|
||||||
}{{/bodyParam}}
|
}
|
||||||
|
{{/bodyParam}}
|
||||||
|
|
||||||
{{#authMethods}}
|
{{#authMethods}}
|
||||||
// authentication ({{name}}) required
|
// authentication ({{name}}) required
|
||||||
{{#isApiKey}}{{#isKeyInHeader}}
|
{{#isApiKey}}
|
||||||
|
{{#isKeyInHeader}}
|
||||||
if (!String.IsNullOrEmpty(Configuration.GetApiKeyWithPrefix("{{keyParamName}}")))
|
if (!String.IsNullOrEmpty(Configuration.GetApiKeyWithPrefix("{{keyParamName}}")))
|
||||||
{
|
{
|
||||||
localVarHeaderParams["{{keyParamName}}"] = Configuration.GetApiKeyWithPrefix("{{keyParamName}}");
|
localVarHeaderParams["{{keyParamName}}"] = Configuration.GetApiKeyWithPrefix("{{keyParamName}}");
|
||||||
}{{/isKeyInHeader}}{{#isKeyInQuery}}
|
}
|
||||||
|
{{/isKeyInHeader}}
|
||||||
|
{{#isKeyInQuery}}
|
||||||
if (!String.IsNullOrEmpty(Configuration.GetApiKeyWithPrefix("{{keyParamName}}")))
|
if (!String.IsNullOrEmpty(Configuration.GetApiKeyWithPrefix("{{keyParamName}}")))
|
||||||
{
|
{
|
||||||
localVarQueryParams["{{keyParamName}}"] = Configuration.GetApiKeyWithPrefix("{{keyParamName}}");
|
localVarQueryParams["{{keyParamName}}"] = Configuration.GetApiKeyWithPrefix("{{keyParamName}}");
|
||||||
}{{/isKeyInQuery}}{{/isApiKey}}{{#isBasic}}
|
}
|
||||||
|
{{/isKeyInQuery}}
|
||||||
|
{{/isApiKey}}
|
||||||
|
{{#isBasic}}
|
||||||
// http basic authentication required
|
// http basic authentication required
|
||||||
if (!String.IsNullOrEmpty(Configuration.Username) || !String.IsNullOrEmpty(Configuration.Password))
|
if (!String.IsNullOrEmpty(Configuration.Username) || !String.IsNullOrEmpty(Configuration.Password))
|
||||||
{
|
{
|
||||||
localVarHeaderParams["Authorization"] = "Basic " + ApiClient.Base64Encode(Configuration.Username + ":" + Configuration.Password);
|
localVarHeaderParams["Authorization"] = "Basic " + ApiClient.Base64Encode(Configuration.Username + ":" + Configuration.Password);
|
||||||
}{{/isBasic}}{{#isOAuth}}
|
}
|
||||||
|
{{/isBasic}}
|
||||||
|
{{#isOAuth}}
|
||||||
// oauth required
|
// oauth required
|
||||||
if (!String.IsNullOrEmpty(Configuration.AccessToken))
|
if (!String.IsNullOrEmpty(Configuration.AccessToken))
|
||||||
{
|
{
|
||||||
localVarHeaderParams["Authorization"] = "Bearer " + Configuration.AccessToken;
|
localVarHeaderParams["Authorization"] = "Bearer " + Configuration.AccessToken;
|
||||||
}{{/isOAuth}}
|
}
|
||||||
|
{{/isOAuth}}
|
||||||
{{/authMethods}}
|
{{/authMethods}}
|
||||||
|
|
||||||
// make the HTTP request
|
// make the HTTP request
|
||||||
@ -379,7 +420,9 @@ namespace {{packageName}}.Api
|
|||||||
{{^returnType}}return new ApiResponse<Object>(localVarStatusCode,
|
{{^returnType}}return new ApiResponse<Object>(localVarStatusCode,
|
||||||
localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
|
localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
|
||||||
null);{{/returnType}}
|
null);{{/returnType}}
|
||||||
}{{/supportsAsync}}
|
}
|
||||||
|
|
||||||
|
{{/supportsAsync}}
|
||||||
{{/operation}}
|
{{/operation}}
|
||||||
}
|
}
|
||||||
{{/operations}}
|
{{/operations}}
|
||||||
|
@ -0,0 +1,96 @@
|
|||||||
|
# {{packageName}}.Api.{{classname}}{{#description}}
|
||||||
|
{{description}}{{/description}}
|
||||||
|
|
||||||
|
All URIs are relative to *{{basePath}}*
|
||||||
|
|
||||||
|
Method | HTTP request | Description
|
||||||
|
------------- | ------------- | -------------
|
||||||
|
{{#operations}}{{#operation}}[**{{operationId}}**]({{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}}
|
||||||
|
{{/operation}}{{/operations}}
|
||||||
|
|
||||||
|
{{#operations}}
|
||||||
|
{{#operation}}
|
||||||
|
# **{{{operationId}}}**
|
||||||
|
> {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}} {{operationId}} ({{#allParams}}{{{dataType}}} {{paramName}}{{^required}}{{#optionalMethodArgument}} = null{{/optionalMethodArgument}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}})
|
||||||
|
|
||||||
|
{{{summary}}}{{#notes}}
|
||||||
|
|
||||||
|
{{{notes}}}{{/notes}}
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```csharp
|
||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using {{packageName}}.Api;
|
||||||
|
using {{packageName}}.Client;
|
||||||
|
using {{packageName}}.Model;
|
||||||
|
|
||||||
|
namespace Example
|
||||||
|
{
|
||||||
|
public class {{operationId}}Example
|
||||||
|
{
|
||||||
|
public void main()
|
||||||
|
{
|
||||||
|
{{#hasAuthMethods}}{{#authMethods}}{{#isBasic}}
|
||||||
|
// Configure HTTP basic authorization: {{{name}}}
|
||||||
|
Configuration.Default.Username = 'YOUR_USERNAME';
|
||||||
|
Configuration.Default.Password = 'YOUR_PASSWORD';{{/isBasic}}{{#isApiKey}}
|
||||||
|
// Configure API key authorization: {{{name}}}
|
||||||
|
Configuration.Default.ApiKey.Add('{{{keyParamName}}}', 'YOUR_API_KEY');
|
||||||
|
// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed
|
||||||
|
// Configuration.Default.ApiKeyPrefix.Add('{{{keyParamName}}}', 'BEARER');{{/isApiKey}}{{#isOAuth}}
|
||||||
|
// Configure OAuth2 access token for authorization: {{{name}}}
|
||||||
|
Configuration.Default.AccessToken = 'YOUR_ACCESS_TOKEN';{{/isOAuth}}{{/authMethods}}
|
||||||
|
{{/hasAuthMethods}}
|
||||||
|
|
||||||
|
var apiInstance = new {{classname}}();
|
||||||
|
{{#allParams}}
|
||||||
|
{{#isPrimitiveType}}
|
||||||
|
var {{paramName}} = {{example}}; // {{{dataType}}} | {{{description}}}{{^required}} (optional) {{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}}
|
||||||
|
{{/isPrimitiveType}}
|
||||||
|
{{^isPrimitiveType}}
|
||||||
|
var {{paramName}} = new {{{dataType}}}(); // {{{dataType}}} | {{{description}}}{{^required}} (optional) {{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}}
|
||||||
|
{{/isPrimitiveType}}
|
||||||
|
{{/allParams}}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
{{#summary}}
|
||||||
|
// {{{.}}}
|
||||||
|
{{/summary}}
|
||||||
|
{{#returnType}}{{returnType}} result = {{/returnType}}apiInstance.{{{operationId}}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{#returnType}}
|
||||||
|
Debug.WriteLine(result);{{/returnType}}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Debug.Print("Exception when calling {{classname}}.{{operationId}}: " + e.Message );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
{{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#allParams}}{{#-last}}
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------{{/-last}}{{/allParams}}
|
||||||
|
{{#allParams}} **{{paramName}}** | {{#isFile}}**{{{dataType}}}**{{/isFile}}{{#isPrimitiveType}}**{{{dataType}}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{^isFile}}[**{{{dataType}}}**]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}}| {{description}} | {{^required}}[optional] {{/required}}{{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}}
|
||||||
|
{{/allParams}}
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
{{#returnType}}{{#returnTypeIsPrimitive}}**{{{returnType}}}**{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}[**{{{returnType}}}**]({{returnBaseType}}.md){{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}}void (empty response body){{/returnType}}
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
{{^authMethods}}No authorization required{{/authMethods}}{{#authMethods}}[{{{name}}}](../README.md#{{{name}}}){{^-last}}, {{/-last}}{{/authMethods}}
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: {{#consumes}}{{mediaType}}{{#hasMore}}, {{/hasMore}}{{/consumes}}{{^consumes}}Not defined{{/consumes}}
|
||||||
|
- **Accept**: {{#produces}}{{mediaType}}{{#hasMore}}, {{/hasMore}}{{/produces}}{{^produces}}Not defined{{/produces}}
|
||||||
|
|
||||||
|
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
{{/operation}}
|
||||||
|
{{/operations}}
|
@ -61,7 +61,8 @@ namespace {{packageName}}.Test
|
|||||||
public void {{operationId}}Test()
|
public void {{operationId}}Test()
|
||||||
{
|
{
|
||||||
// TODO: add unit test for the method '{{operationId}}'
|
// TODO: add unit test for the method '{{operationId}}'
|
||||||
{{#allParams}}{{{dataType}}} {{paramName}} = null; // TODO: replace null with proper value
|
{{#allParams}}
|
||||||
|
{{{dataType}}} {{paramName}} = null; // TODO: replace null with proper value
|
||||||
{{/allParams}}
|
{{/allParams}}
|
||||||
{{#returnType}}var response = {{/returnType}}instance.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
|
{{#returnType}}var response = {{/returnType}}instance.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
|
||||||
{{#returnType}}Assert.IsInstanceOf<{{{returnType}}}> (response, "response is {{{returnType}}}");{{/returnType}}
|
{{#returnType}}Assert.IsInstanceOf<{{{returnType}}}> (response, "response is {{{returnType}}}");{{/returnType}}
|
||||||
|
@ -81,8 +81,9 @@ namespace {{packageName}}.Model
|
|||||||
{
|
{
|
||||||
var sb = new StringBuilder();
|
var sb = new StringBuilder();
|
||||||
sb.Append("class {{classname}} {\n");
|
sb.Append("class {{classname}} {\n");
|
||||||
{{#vars}}sb.Append(" {{name}}: ").Append({{name}}).Append("\n");
|
{{#vars}}
|
||||||
{{/vars}}
|
sb.Append(" {{name}}: ").Append({{name}}).Append("\n");
|
||||||
|
{{/vars}}
|
||||||
sb.Append("}\n");
|
sb.Append("}\n");
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,14 @@
|
|||||||
|
{{#models}}
|
||||||
|
{{#model}}
|
||||||
|
# {{{packageName}}}.Model.{{{classname}}}
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
{{#vars}}**{{name}}** | {{#isPrimitiveType}}**{{datatype}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{datatype}}**]({{complexType}}.md){{/isPrimitiveType}} | {{description}} | {{^required}}[optional] {{/required}}{{#readOnly}}[readonly] {{/readOnly}}{{#defaultValue}}[default to {{{.}}}]{{/defaultValue}}
|
||||||
|
{{/vars}}
|
||||||
|
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
{{/model}}
|
||||||
|
{{/models}}
|
@ -18,11 +18,11 @@ class {{classname}} {
|
|||||||
/// {{notes}}
|
/// {{notes}}
|
||||||
{{#returnType}}Future<{{{returnType}}}> {{/returnType}}{{^returnType}}Future {{/returnType}}{{nickname}}({{#allParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) {
|
{{#returnType}}Future<{{{returnType}}}> {{/returnType}}{{^returnType}}Future {{/returnType}}{{nickname}}({{#allParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) {
|
||||||
Object postBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}};
|
Object postBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}};
|
||||||
{{#requiredParamCount}}
|
{{#allParams}}
|
||||||
// verify required params are set
|
// verify required params are set
|
||||||
if({{/requiredParamCount}}{{#requiredParams}} {{paramName}} == null {{#hasMore}}|| {{/hasMore}}{{/requiredParams}}{{#requiredParamCount}}) {
|
if({{/allParams}}{{#required}} {{paramName}} == null {{#hasMore}}|| {{/hasMore}}{{/required}}{{#allParams}}) {
|
||||||
throw new ApiException(400, "missing required params");
|
throw new ApiException(400, "missing required params");
|
||||||
}{{/requiredParamCount}}
|
}{{/allParams}}
|
||||||
|
|
||||||
// create path and map variables
|
// create path and map variables
|
||||||
String path = "{{path}}".replaceAll("{format}","json"){{#pathParams}}.replaceAll("{" + "{{paramName}}" + "}", {{{paramName}}}.toString()){{/pathParams}};
|
String path = "{{path}}".replaceAll("{format}","json"){{#pathParams}}.replaceAll("{" + "{{paramName}}" + "}", {{{paramName}}}.toString()){{/pathParams}};
|
||||||
|
@ -42,12 +42,12 @@ public class {{classname}} extends SwaggerApi {
|
|||||||
var queryParams: Dictionary = new Dictionary();
|
var queryParams: Dictionary = new Dictionary();
|
||||||
var headerParams: Dictionary = new Dictionary();
|
var headerParams: Dictionary = new Dictionary();
|
||||||
|
|
||||||
{{#requiredParamCount}}
|
{{#allParams}}
|
||||||
// verify required params are set
|
// verify required params are set
|
||||||
if({{/requiredParamCount}}{{#requiredParams}} {{paramName}} == null {{#hasMore}}|| {{/hasMore}}{{/requiredParams}}{{#requiredParamCount}}) {
|
if({{/allParams}}{{#required}} {{paramName}} == null {{#hasMore}}|| {{/hasMore}}{{/required}}{{#allParams}}) {
|
||||||
throw new ApiError(400, "missing required params");
|
throw new ApiError(400, "missing required params");
|
||||||
}
|
}
|
||||||
{{/requiredParamCount}}
|
{{/allParams}}
|
||||||
|
|
||||||
{{#queryParams}}if("null" != String({{paramName}}))
|
{{#queryParams}}if("null" != String({{paramName}}))
|
||||||
queryParams["{{paramName}}"] = toPathValue({{paramName}});
|
queryParams["{{paramName}}"] = toPathValue({{paramName}});
|
||||||
|
52
modules/swagger-codegen/src/main/resources/flash/git_push.sh.mustache
Executable file
52
modules/swagger-codegen/src/main/resources/flash/git_push.sh.mustache
Executable file
@ -0,0 +1,52 @@
|
|||||||
|
#!/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-perl "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'
|
||||||
|
|
@ -0,0 +1,11 @@
|
|||||||
|
# Build and Release Folders
|
||||||
|
bin/
|
||||||
|
bin-debug/
|
||||||
|
bin-release/
|
||||||
|
|
||||||
|
# Other files and folders
|
||||||
|
.settings/
|
||||||
|
|
||||||
|
# Project files, i.e. `.project`, `.actionScriptProperties` and `.flexProperties`
|
||||||
|
# should NOT be excluded as they contain compiler settings and other important
|
||||||
|
# information for Eclipse / Flash Builder.
|
@ -3,9 +3,9 @@
|
|||||||
{{#operations}}
|
{{#operations}}
|
||||||
{{#operation}}
|
{{#operation}}
|
||||||
|
|
||||||
def {{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) -> str:
|
def {{operationId}}({{#allParams}}{{paramName}}{{^required}} = None{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}){{^supportPython2}} -> str{{/supportPython2}}:
|
||||||
return 'do some magic!'
|
return 'do some magic!'
|
||||||
{{/operation}}
|
{{/operation}}
|
||||||
{{/operations}}
|
{{/operations}}
|
||||||
{{/apis}}
|
{{/apis}}
|
||||||
{{/apiInfo}}
|
{{/apiInfo}}
|
||||||
|
@ -1,8 +1,19 @@
|
|||||||
# Go API client for {{packageName}}
|
# Go API client for {{packageName}}
|
||||||
|
|
||||||
|
{{#appDescription}}
|
||||||
|
{{{appDescription}}}
|
||||||
|
{{/appDescription}}
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
This API client was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. By using the [swagger-spec](https://github.com/swagger-api/swagger-spec) from a remote server, you can easily generate an API client.
|
This API client was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. By using the [swagger-spec](https://github.com/swagger-api/swagger-spec) from a remote server, you can easily generate an API client.
|
||||||
|
|
||||||
|
- API version: {{appVersion}}
|
||||||
|
- Package version: {{packageVersion}}
|
||||||
|
- Build date: {{generatedDate}}
|
||||||
|
- Build package: {{generatorClass}}
|
||||||
|
{{#infoUrl}}
|
||||||
|
For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}})
|
||||||
|
{{/infoUrl}}
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
Put the package under your project folder and add the following in import:
|
Put the package under your project folder and add the following in import:
|
||||||
@ -10,3 +21,43 @@ Put the package under your project folder and add the following in import:
|
|||||||
"./{{packageName}}"
|
"./{{packageName}}"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Documentation for API Endpoints
|
||||||
|
|
||||||
|
All URIs are relative to *{{basePath}}*
|
||||||
|
|
||||||
|
Class | Method | HTTP request | Description
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}}
|
||||||
|
{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}
|
||||||
|
|
||||||
|
## Documentation For Models
|
||||||
|
|
||||||
|
{{#models}}{{#model}} - [{{{classname}}}]({{modelDocPath}}{{{classname}}}.md)
|
||||||
|
{{/model}}{{/models}}
|
||||||
|
|
||||||
|
## Documentation For Authorization
|
||||||
|
|
||||||
|
{{^authMethods}} All endpoints do not require authorization.
|
||||||
|
{{/authMethods}}{{#authMethods}}{{#last}} Authentication schemes defined for the API:{{/last}}{{/authMethods}}
|
||||||
|
{{#authMethods}}## {{{name}}}
|
||||||
|
|
||||||
|
{{#isApiKey}}- **Type**: API key
|
||||||
|
- **API key parameter name**: {{{keyParamName}}}
|
||||||
|
- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}}
|
||||||
|
{{/isApiKey}}
|
||||||
|
{{#isBasic}}- **Type**: HTTP basic authentication
|
||||||
|
{{/isBasic}}
|
||||||
|
{{#isOAuth}}- **Type**: OAuth
|
||||||
|
- **Flow**: {{{flow}}}
|
||||||
|
- **Authorizatoin URL**: {{{authorizationUrl}}}
|
||||||
|
- **Scopes**: {{^scopes}}N/A{{/scopes}}
|
||||||
|
{{#scopes}} - **{{{scope}}}**: {{{description}}}
|
||||||
|
{{/scopes}}
|
||||||
|
{{/isOAuth}}
|
||||||
|
|
||||||
|
{{/authMethods}}
|
||||||
|
|
||||||
|
## Author
|
||||||
|
|
||||||
|
{{#apiInfo}}{{#apis}}{{^hasMore}}{{infoEmail}}
|
||||||
|
{{/hasMore}}{{/apis}}{{/apiInfo}}
|
||||||
|
@ -38,11 +38,43 @@ func New{{classname}}WithBasePath(basePath string) *{{classname}}{
|
|||||||
{{#allParams}} * @param {{paramName}} {{description}}
|
{{#allParams}} * @param {{paramName}} {{description}}
|
||||||
{{/allParams}} * @return {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}
|
{{/allParams}} * @return {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}
|
||||||
*/
|
*/
|
||||||
//func (a {{classname}}) {{nickname}} ({{#allParams}}{{paramName}} {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) ({{#returnType}}{{{returnType}}}, {{/returnType}}error) {
|
|
||||||
func (a {{classname}}) {{nickname}} ({{#allParams}}{{paramName}} {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) ({{#returnType}}{{{returnType}}}, {{/returnType}}error) {
|
func (a {{classname}}) {{nickname}} ({{#allParams}}{{paramName}} {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) ({{#returnType}}{{{returnType}}}, {{/returnType}}error) {
|
||||||
|
{{#allParams}}
|
||||||
|
{{#required}}
|
||||||
|
// verify the required parameter '{{paramName}}' is set
|
||||||
|
if &{{paramName}} == nil {
|
||||||
|
return {{#returnType}}*new({{{returnType}}}), {{/returnType}}errors.New("Missing required parameter '{{paramName}}' when calling {{classname}}->{{operationId}}")
|
||||||
|
}
|
||||||
|
{{/required}}
|
||||||
|
{{/allParams}}
|
||||||
_sling := sling.New().{{httpMethod}}(a.Configuration.BasePath)
|
_sling := sling.New().{{httpMethod}}(a.Configuration.BasePath)
|
||||||
|
|
||||||
|
{{#authMethods}}// authentication ({{name}}) required
|
||||||
|
{{#isApiKey}}{{#isKeyInHeader}}
|
||||||
|
// set key with prefix in header
|
||||||
|
_sling.Set("{{keyParamName}}", a.Configuration.GetApiKeyWithPrefix("{{keyParamName}}"))
|
||||||
|
{{/isKeyInHeader}}{{#isKeyInQuery}}
|
||||||
|
// set key with prefix in querystring
|
||||||
|
{{#hasKeyParamName}} type KeyQueryParams struct {
|
||||||
|
{{keyParamName}} string `url:"{{keyParamName}},omitempty"`
|
||||||
|
}
|
||||||
|
_sling = _sling.QueryStruct(&KeyQueryParams{ {{keyParamName}}: a.Configuration.GetApiKeyWithPrefix("{{keyParamName}}") })
|
||||||
|
{{/hasKeyParamName}}
|
||||||
|
{{/isKeyInQuery}}{{/isApiKey}}
|
||||||
|
{{#isBasic}}
|
||||||
|
// http basic authentication required
|
||||||
|
if a.Configuration.Username != "" || a.Configuration.Password != ""{
|
||||||
|
_sling.Set("Authorization", "Basic " + a.Configuration.GetBasicAuthEncodedString())
|
||||||
|
}
|
||||||
|
{{/isBasic}}
|
||||||
|
{{#isOAuth}}
|
||||||
|
// oauth required
|
||||||
|
if a.Configuration.AccessToken != ""{
|
||||||
|
_sling.Set("Authorization", "Bearer " + a.Configuration.AccessToken)
|
||||||
|
}
|
||||||
|
{{/isOAuth}}
|
||||||
|
{{/authMethods}}
|
||||||
|
|
||||||
// create path and map variables
|
// create path and map variables
|
||||||
path := "{{basePathWithoutHost}}{{path}}"
|
path := "{{basePathWithoutHost}}{{path}}"
|
||||||
{{#pathParams}} path = strings.Replace(path, "{" + "{{baseName}}" + "}", fmt.Sprintf("%v", {{paramName}}), -1)
|
{{#pathParams}} path = strings.Replace(path, "{" + "{{baseName}}" + "}", fmt.Sprintf("%v", {{paramName}}), -1)
|
||||||
@ -50,26 +82,49 @@ func (a {{classname}}) {{nickname}} ({{#allParams}}{{paramName}} {{{dataType}}}{
|
|||||||
|
|
||||||
_sling = _sling.Path(path)
|
_sling = _sling.Path(path)
|
||||||
|
|
||||||
|
// add default headers if any
|
||||||
|
for key := range a.Configuration.DefaultHeader {
|
||||||
|
_sling = _sling.Set(key, a.Configuration.DefaultHeader[key])
|
||||||
|
}
|
||||||
|
|
||||||
{{#hasQueryParams}} type QueryParams struct {
|
{{#hasQueryParams}} type QueryParams struct {
|
||||||
{{#queryParams}}{{paramName}} {{dataType}} `url:"{{baseName}},omitempty"`
|
{{#queryParams}}{{vendorExtensions.x-exportParamName}} {{dataType}} `url:"{{baseName}},omitempty"`
|
||||||
{{/queryParams}}
|
{{/queryParams}}
|
||||||
}
|
}
|
||||||
_sling = _sling.QueryStruct(&QueryParams{ {{#queryParams}}{{paramName}}: {{paramName}}{{#hasMore}},{{/hasMore}}{{/queryParams}} })
|
_sling = _sling.QueryStruct(&QueryParams{ {{#queryParams}}{{vendorExtensions.x-exportParamName}}: {{paramName}}{{#hasMore}},{{/hasMore}}{{/queryParams}} })
|
||||||
{{/hasQueryParams}}
|
{{/hasQueryParams}}
|
||||||
// accept header
|
|
||||||
accepts := []string { {{#produces}}"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }
|
// to determine the Content-Type header
|
||||||
for key := range accepts {
|
localVarHttpContentTypes := []string {
|
||||||
_sling = _sling.Set("Accept", accepts[key])
|
{{#consumes}}
|
||||||
break // only use the first Accept
|
"{{mediaType}}",
|
||||||
|
{{/consumes}}
|
||||||
|
}
|
||||||
|
//set Content-Type header
|
||||||
|
localVarHttpContentType := a.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes)
|
||||||
|
if localVarHttpContentType != "" {
|
||||||
|
_sling = _sling.Set("Content-Type", localVarHttpContentType)
|
||||||
|
}
|
||||||
|
|
||||||
|
// to determine the Accept header
|
||||||
|
localVarHttpHeaderAccepts := []string {
|
||||||
|
{{#produces}}
|
||||||
|
"{{mediaType}}",
|
||||||
|
{{/produces}}
|
||||||
|
}
|
||||||
|
//set Accept header
|
||||||
|
localVarHttpHeaderAccept := a.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
|
if localVarHttpHeaderAccept != "" {
|
||||||
|
_sling = _sling.Set("Accept", localVarHttpHeaderAccept)
|
||||||
}
|
}
|
||||||
{{#hasHeaderParams}}{{#headerParams}} // header params "{{baseName}}"
|
{{#hasHeaderParams}}{{#headerParams}} // header params "{{baseName}}"
|
||||||
_sling = _sling.Set("{{baseName}}", {{paramName}})
|
_sling = _sling.Set("{{baseName}}", {{paramName}})
|
||||||
{{/headerParams}}{{/hasHeaderParams}}
|
{{/headerParams}}{{/hasHeaderParams}}
|
||||||
{{#hasFormParams}} type FormParams struct {
|
{{#hasFormParams}} type FormParams struct {
|
||||||
{{#formParams}} {{paramName}} {{dataType}} `url:"{{baseName}},omitempty"`
|
{{#formParams}} {{vendorExtensions.x-exportParamName}} {{dataType}} `url:"{{baseName}},omitempty"`
|
||||||
{{/formParams}}
|
{{/formParams}}
|
||||||
}
|
}
|
||||||
_sling = _sling.BodyForm(&FormParams{ {{#formParams}}{{paramName}}: {{paramName}}{{#hasMore}},{{/hasMore}}{{/formParams}} })
|
_sling = _sling.BodyForm(&FormParams{ {{#formParams}}{{vendorExtensions.x-exportParamName}}: {{paramName}}{{#hasMore}},{{/hasMore}}{{/formParams}} })
|
||||||
{{/hasFormParams}}
|
{{/hasFormParams}}
|
||||||
{{#hasBodyParam}}{{#bodyParams}}// body params
|
{{#hasBodyParam}}{{#bodyParams}}// body params
|
||||||
_sling = _sling.BodyJSON({{paramName}})
|
_sling = _sling.BodyJSON({{paramName}})
|
||||||
|
@ -0,0 +1,41 @@
|
|||||||
|
package {{packageName}}
|
||||||
|
|
||||||
|
import (
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
type ApiClient struct {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *ApiClient) SelectHeaderContentType(contentTypes []string) string {
|
||||||
|
if (len(contentTypes) == 0){
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
if contains(contentTypes,"application/json") {
|
||||||
|
return "application/json"
|
||||||
|
}
|
||||||
|
|
||||||
|
return contentTypes[0] // use the first content type specified in 'consumes'
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *ApiClient) SelectHeaderAccept(accepts []string) string {
|
||||||
|
if (len(accepts) == 0){
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
if contains(accepts,"application/json"){
|
||||||
|
return "application/json"
|
||||||
|
}
|
||||||
|
|
||||||
|
return strings.Join(accepts,",")
|
||||||
|
}
|
||||||
|
|
||||||
|
func contains(source []string, containvalue string) bool {
|
||||||
|
for _, a := range source {
|
||||||
|
if strings.ToLower(a) == strings.ToLower(containvalue) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
@ -0,0 +1,44 @@
|
|||||||
|
# {{invokerPackage}}\{{classname}}{{#description}}
|
||||||
|
{{description}}{{/description}}
|
||||||
|
|
||||||
|
All URIs are relative to *{{basePath}}*
|
||||||
|
|
||||||
|
Method | HTTP request | Description
|
||||||
|
------------- | ------------- | -------------
|
||||||
|
{{#operations}}{{#operation}}[**{{operationId}}**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}}
|
||||||
|
{{/operation}}{{/operations}}
|
||||||
|
|
||||||
|
{{#operations}}
|
||||||
|
{{#operation}}
|
||||||
|
# **{{{operationId}}}**
|
||||||
|
> {{#returnType}}{{{returnType}}} {{/returnType}}{{{operationId}}}({{#allParams}}${{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}})
|
||||||
|
|
||||||
|
{{{summary}}}{{#notes}}
|
||||||
|
|
||||||
|
{{{notes}}}{{/notes}}
|
||||||
|
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
{{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#allParams}}{{#-last}}
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------{{/-last}}{{/allParams}}
|
||||||
|
{{#allParams}} **{{paramName}}** | {{#isFile}}**{{dataType}}**{{/isFile}}{{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{^isFile}}[**{{dataType}}**]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}}| {{description}} | {{^required}}[optional] {{/required}}{{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}}
|
||||||
|
{{/allParams}}
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
{{#returnType}}{{#returnTypeIsPrimitive}}**{{{returnType}}}**{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}[**{{{returnType}}}**]({{returnBaseType}}.md){{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}}void (empty response body){{/returnType}}
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
{{^authMethods}}No authorization required{{/authMethods}}{{#authMethods}}[{{{name}}}](../README.md#{{{name}}}){{^-last}}, {{/-last}}{{/authMethods}}
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: {{#consumes}}{{mediaType}}{{#hasMore}}, {{/hasMore}}{{/consumes}}{{^consumes}}Not defined{{/consumes}}
|
||||||
|
- **Accept**: {{#produces}}{{mediaType}}{{#hasMore}}, {{/hasMore}}{{/produces}}{{^produces}}Not defined{{/produces}}
|
||||||
|
|
||||||
|
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
{{/operation}}
|
||||||
|
{{/operations}}
|
@ -1,12 +1,14 @@
|
|||||||
package {{packageName}}
|
package {{packageName}}
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/base64"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Configuration struct {
|
type Configuration struct {
|
||||||
UserName string `json:"userName,omitempty"`
|
UserName string `json:"userName,omitempty"`
|
||||||
ApiKey string `json:"apiKey,omitempty"`
|
Password string `json:"password,omitempty"`
|
||||||
|
ApiKeyPrefix map[string] string `json:"apiKeyPrefix,omitempty"`
|
||||||
|
ApiKey map[string] string `json:"apiKey,omitempty"`
|
||||||
Debug bool `json:"debug,omitempty"`
|
Debug bool `json:"debug,omitempty"`
|
||||||
DebugFile string `json:"debugFile,omitempty"`
|
DebugFile string `json:"debugFile,omitempty"`
|
||||||
OAuthToken string `json:"oAuthToken,omitempty"`
|
OAuthToken string `json:"oAuthToken,omitempty"`
|
||||||
@ -14,6 +16,10 @@ type Configuration struct {
|
|||||||
BasePath string `json:"basePath,omitempty"`
|
BasePath string `json:"basePath,omitempty"`
|
||||||
Host string `json:"host,omitempty"`
|
Host string `json:"host,omitempty"`
|
||||||
Scheme string `json:"scheme,omitempty"`
|
Scheme string `json:"scheme,omitempty"`
|
||||||
|
AccessToken string `json:"accessToken,omitempty"`
|
||||||
|
DefaultHeader map[string]string `json:"defaultHeader,omitempty"`
|
||||||
|
UserAgent string `json:"userAgent,omitempty"`
|
||||||
|
ApiClient ApiClient `json:"apiClient,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewConfiguration() *Configuration {
|
func NewConfiguration() *Configuration {
|
||||||
@ -21,5 +27,25 @@ func NewConfiguration() *Configuration {
|
|||||||
BasePath: "{{basePath}}",
|
BasePath: "{{basePath}}",
|
||||||
UserName: "",
|
UserName: "",
|
||||||
Debug: false,
|
Debug: false,
|
||||||
|
DefaultHeader: make(map[string]string),
|
||||||
|
ApiKey: make(map[string]string),
|
||||||
|
ApiKeyPrefix: make(map[string]string),
|
||||||
|
UserAgent: "{{#httpUserAgent}}{{{.}}}{{/httpUserAgent}}{{^httpUserAgent}}Swagger-Codegen/{{{packageVersion}}}/go{{/httpUserAgent}}",
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Configuration) GetBasicAuthEncodedString() string {
|
||||||
|
return base64.StdEncoding.EncodeToString([]byte(c.UserName + ":" + c.Password))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Configuration) AddDefaultHeader(key string, value string) {
|
||||||
|
c.DefaultHeader[key] = value
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Configuration) GetApiKeyWithPrefix(apiKeyIdentifier string) string {
|
||||||
|
if c.ApiKeyPrefix[apiKeyIdentifier] != ""{
|
||||||
|
return c.ApiKeyPrefix[apiKeyIdentifier] + " " + c.ApiKey[apiKeyIdentifier]
|
||||||
|
}
|
||||||
|
|
||||||
|
return c.ApiKey[apiKeyIdentifier]
|
||||||
}
|
}
|
@ -7,8 +7,11 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
{{#model}}
|
{{#model}}
|
||||||
|
{{#description}}// {{{description}}}{{/description}}
|
||||||
type {{classname}} struct {
|
type {{classname}} struct {
|
||||||
{{#vars}}{{name}} {{{datatype}}} `json:"{{baseName}},omitempty"`
|
{{#vars}}
|
||||||
|
{{#description}}// {{{description}}}{{/description}}
|
||||||
|
{{name}} {{{datatype}}} `json:"{{baseName}},omitempty"`
|
||||||
{{/vars}}
|
{{/vars}}
|
||||||
}
|
}
|
||||||
{{/model}}
|
{{/model}}
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user