diff --git a/README.md b/README.md index 40ef667dfa0b..c7abdc9a0d2c 100644 --- a/README.md +++ b/README.md @@ -792,6 +792,7 @@ Here are some companies/projects using Swagger Codegen in production. To add you - [snapCX](https://snapcx.io) - [SPINEN](http://www.spinen.com) - [SRC](https://www.src.si/) +- [Stardog Ventures](https://www.stardog.io) - [Stingray](http://www.stingray.com) - [StyleRecipe](http://stylerecipe.co.jp) - [Svenska Spel AB](https://www.svenskaspel.se/) @@ -879,10 +880,12 @@ Here is a list of template creators: * Java (Jersey2): @xhh * Java (okhttp-gson): @xhh * Java (RestTemplate): @nbruno + * Java (RESTEasy): @gayathrigs * Javascript/NodeJS: @jfiala * Javascript (Closure-annotated Angular) @achew22 * JMeter @davidkiss * Perl: @wing328 + * PHP (Guzzle): @baartosz * Swift: @tkqubo * Swift 3: @hexelon * TypeScript (Node): @mhardorf diff --git a/bin/android-petstore-httpclient.sh b/bin/android-petstore-httpclient.sh index 097484e04108..aa11ee16fec2 100755 --- a/bin/android-petstore-httpclient.sh +++ b/bin/android-petstore-httpclient.sh @@ -26,6 +26,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="$@ generate -t modules/swagger-codegen/src/main/resources/android -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l android -Dlibrary=httpclient -o samples/client/petstore/android/httpclient" +ags="$@ generate -t modules/swagger-codegen/src/main/resources/android -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l android -Dlibrary=httpclient -o samples/client/petstore/android/httpclient" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/android-petstore-volley.sh b/bin/android-petstore-volley.sh index 6bd15b7f5715..57e74a2becfe 100755 --- a/bin/android-petstore-volley.sh +++ b/bin/android-petstore-volley.sh @@ -26,6 +26,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l android -c bin/android-petstore-volley.json -o samples/client/petstore/android/volley" +ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l android -c bin/android-petstore-volley.json -o samples/client/petstore/android/volley" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/clojure-petstore.sh b/bin/clojure-petstore.sh index 1f53d9d386c7..2c55a03e1c5e 100755 --- a/bin/clojure-petstore.sh +++ b/bin/clojure-petstore.sh @@ -26,6 +26,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l clojure -o samples/client/petstore/clojure" +ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l clojure -o samples/client/petstore/clojure" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/csharp-petstore-net-standard.sh b/bin/csharp-petstore-net-standard.sh index 6d00c330896f..d4c941372267 100755 --- a/bin/csharp-petstore-net-standard.sh +++ b/bin/csharp-petstore-net-standard.sh @@ -26,6 +26,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate $@ -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l csharp -o samples/client/petstore/csharp/SwaggerClientNetStanard --additional-properties packageGuid={321C8C3F-0156-40C1-AE42-D59761FB9B6C} -c ./bin/csharp-petstore-net-standard.json" +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/SwaggerClientNetStandard --additional-properties packageGuid={321C8C3F-0156-40C1-AE42-D59761FB9B6C} -c ./bin/csharp-petstore-net-standard.json" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/csharp-petstore-netcore-project.sh b/bin/csharp-petstore-netcore-project.sh index 2b10b2e0108f..3ae3e71a6f3d 100755 --- a/bin/csharp-petstore-netcore-project.sh +++ b/bin/csharp-petstore-netcore-project.sh @@ -26,6 +26,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate $@ -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l csharp -o samples/client/petstore/csharp/SwaggerClientNetCoreProject --additional-properties packageGuid={67035b31-f8e5-41a4-9673-954035084f7d},netCoreProjectFile=true -c ./bin/csharp-petstore-v5.json" +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/SwaggerClientNetCoreProject --additional-properties packageGuid={67035b31-f8e5-41a4-9673-954035084f7d},netCoreProjectFile=true -c ./bin/csharp-petstore-net-standard.json" -java $JAVA_OPTS -jar $executable $ags \ No newline at end of file +java $JAVA_OPTS -jar $executable $ags diff --git a/bin/java-petstore-all.sh b/bin/java-petstore-all.sh index bccc58be22f6..226d7eaabc97 100755 --- a/bin/java-petstore-all.sh +++ b/bin/java-petstore-all.sh @@ -5,6 +5,7 @@ ./bin/java-petstore-jersey2.sh ./bin/java-petstore-feign.sh ./bin/java-petstore-okhttp-gson.sh +./bin/java-petstore-okhttp-gson-parcelable.sh ./bin/java-petstore-retrofit.sh ./bin/java-petstore-retrofit2.sh ./bin/java-petstore-retrofit2rx.sh diff --git a/bin/java-petstore-jersey2.json b/bin/java-petstore-jersey2.json index af343e1d6b88..6efa52949a43 100644 --- a/bin/java-petstore-jersey2.json +++ b/bin/java-petstore-jersey2.json @@ -1,4 +1,4 @@ { "library": "jersey2", "artifactId": "swagger-petstore-jersey2" -} \ No newline at end of file +} diff --git a/bin/java-petstore-resteasy.json b/bin/java-petstore-resteasy.json index 0ff51a41fa67..772ae5820021 100755 --- a/bin/java-petstore-resteasy.json +++ b/bin/java-petstore-resteasy.json @@ -1,4 +1,4 @@ { "library": "resteasy", "artifactId": "swagger-petstore-resteasy" -} \ No newline at end of file +} diff --git a/bin/java-petstore-resttemplate.json b/bin/java-petstore-resttemplate.json index b285b107bc44..c5cfe6b2cddc 100644 --- a/bin/java-petstore-resttemplate.json +++ b/bin/java-petstore-resttemplate.json @@ -1,4 +1,4 @@ { "library": "resttemplate", "artifactId": "swagger-petstore-resttemplate" -} \ No newline at end of file +} diff --git a/bin/java-petstore-retrofit2-play24.json b/bin/java-petstore-retrofit2-play24.json index 020d1df198ad..45b46996d1c0 100644 --- a/bin/java-petstore-retrofit2-play24.json +++ b/bin/java-petstore-retrofit2-play24.json @@ -1 +1 @@ -{"useBeanValidation":"true","enableBuilderSupport":"true","library":"retrofit2", "usePlay24WS":"true"} \ No newline at end of file +{"useBeanValidation":"true","enableBuilderSupport":"true","library":"retrofit2", "usePlay24WS":"true"} diff --git a/bin/java-play-framework-petstore-server.sh b/bin/java-play-framework-petstore-server.sh index ff8103e22046..e5d6f48949bb 100755 --- a/bin/java-play-framework-petstore-server.sh +++ b/bin/java-play-framework-petstore-server.sh @@ -26,6 +26,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="$@ generate -t modules/swagger-codegen/src/main/resources/JavaPlayFramework -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l java-play-framework -o samples/server/petstore/java-play-framework -DhideGenerationTimestamp=true" +ags="$@ generate -t modules/swagger-codegen/src/main/resources/JavaPlayFramework -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l java-play-framework -o samples/server/petstore/java-play-framework -DhideGenerationTimestamp=true" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/java8-petstore-jersey2.json b/bin/java8-petstore-jersey2.json index 113828ca9d5b..0b390ba2d677 100644 --- a/bin/java8-petstore-jersey2.json +++ b/bin/java8-petstore-jersey2.json @@ -2,4 +2,4 @@ "library": "jersey2", "artifactId": "swagger-petstore-jersey2", "dateLibrary": "java8" -} \ No newline at end of file +} diff --git a/bin/objc-petstore-coredata.sh b/bin/objc-petstore-coredata.sh index 8487adfc42b2..628281bb7210 100755 --- a/bin/objc-petstore-coredata.sh +++ b/bin/objc-petstore-coredata.sh @@ -26,6 +26,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="$@ generate -t modules/swagger-codegen/src/main/resources/objc -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l objc -DapiDocs=false,modelDocs=false -o samples/client/petstore/objc/core-data --additional-properties coreData=true" +ags="$@ generate -t modules/swagger-codegen/src/main/resources/objc -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l objc -DapiDocs=false,modelDocs=false -o samples/client/petstore/objc/core-data --additional-properties coreData=true" java -DappName=PetstoreClient $JAVA_OPTS -jar $executable $ags diff --git a/bin/objc-petstore.sh b/bin/objc-petstore.sh index 71480ff1595b..d9a21cc55a76 100755 --- a/bin/objc-petstore.sh +++ b/bin/objc-petstore.sh @@ -26,6 +26,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="$@ generate -t modules/swagger-codegen/src/main/resources/objc -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l objc -o samples/client/petstore/objc/default" +ags="$@ generate -t modules/swagger-codegen/src/main/resources/objc -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l objc -o samples/client/petstore/objc/default" java -DappName=PetstoreClient $JAVA_OPTS -jar $executable $ags diff --git a/bin/typescript-petstore-npm.json b/bin/typescript-petstore-npm.json index 1eb3264f5967..1918593ecb54 100755 --- a/bin/typescript-petstore-npm.json +++ b/bin/typescript-petstore-npm.json @@ -2,5 +2,5 @@ "npmName": "@swagger/angular2-typescript-petstore", "npmVersion": "0.0.1", "npmRepository" : "https://skimdb.npmjs.com/registry", - "snapshot" : true + "snapshot" : false } diff --git a/bin/windows/akka-scala-petstore.bat b/bin/windows/akka-scala-petstore.bat index 86ec1ef6efff..f25f640a1db3 100755 --- a/bin/windows/akka-scala-petstore.bat +++ b/bin/windows/akka-scala-petstore.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties -set ags=generate --artifact-id "scala-akka-petstore-client" -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l akka-scala -o samples\client\petstore\akka-scala +set ags=generate --artifact-id "scala-akka-petstore-client" -i modules\swagger-codegen\src\test\resources\2_0\petstore.yaml -l akka-scala -o samples\client\petstore\akka-scala java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/android-petstore-httpclient.bat b/bin/windows/android-petstore-httpclient.bat index a31eb334ef8f..fef42199fb25 100755 --- a/bin/windows/android-petstore-httpclient.bat +++ b/bin/windows/android-petstore-httpclient.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties -set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l android -o samples\client\petstore\android\httpclient-Dlibrary=httpclient +set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.yaml -l android -o samples\client\petstore\android\httpclient-Dlibrary=httpclient java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/android-petstore-volley.bat b/bin/windows/android-petstore-volley.bat index 94db84cc90a0..2c17a7f0d122 100755 --- a/bin/windows/android-petstore-volley.bat +++ b/bin/windows/android-petstore-volley.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties -set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l android -o samples\client\petstore\android\volley +set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.yaml -l android -o samples\client\petstore\android\volley java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/android-petstore.bat b/bin/windows/android-petstore.bat index 21200f128839..423301af2ec2 100755 --- a/bin/windows/android-petstore.bat +++ b/bin/windows/android-petstore.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties -set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l android -o samples\client\petstore\android\default +set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.yaml -l android -o samples\client\petstore\android\default java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/aspnetcore-petstore-server.bat b/bin/windows/aspnetcore-petstore-server.bat index dc38f7ebdec2..e8dc14eadb0e 100755 --- a/bin/windows/aspnetcore-petstore-server.bat +++ b/bin/windows/aspnetcore-petstore-server.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties -set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l aspnetcore -o samples\server\petstore\aspnetcore\ --additional-properties packageGuid={3C799344-F285-4669-8FD5-7ED9B795D5C5} +set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.yaml -l aspnetcore -o samples\server\petstore\aspnetcore\ --additional-properties packageGuid={3C799344-F285-4669-8FD5-7ED9B795D5C5} java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/async-scala-petstore.bat b/bin/windows/async-scala-petstore.bat index 9d3eac55eb2c..be7caec9f6e1 100755 --- a/bin/windows/async-scala-petstore.bat +++ b/bin/windows/async-scala-petstore.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties -set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l async-scala -o samples\client\petstore\async-scala +set ags=generate -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% diff --git a/bin/windows/clojure-petstore.bat b/bin/windows/clojure-petstore.bat index a0f5bb77a4b0..7346a0d26800 100755 --- a/bin/windows/clojure-petstore.bat +++ b/bin/windows/clojure-petstore.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties -set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l clojure -o samples\client\petstore\clojure +set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.yaml -l clojure -o samples\client\petstore\clojure java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/cpprest-petstore.bat b/bin/windows/cpprest-petstore.bat index 9f977cf9b864..d199d8cb9b26 100755 --- a/bin/windows/cpprest-petstore.bat +++ b/bin/windows/cpprest-petstore.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties -set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l cpprest -o samples\client\petstore\cpprest +set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.yaml -l cpprest -o samples\client\petstore\cpprest java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/dart-petstore.bat b/bin/windows/dart-petstore.bat index bb0140ffe0dc..07ef13f6e387 100755 --- a/bin/windows/dart-petstore.bat +++ b/bin/windows/dart-petstore.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties -set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l dart -o samples\client\petstore\dart +set 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% diff --git a/bin/windows/dynamic-html-petstore.bat b/bin/windows/dynamic-html-petstore.bat index be4aa1a5d354..e307d661eb2d 100755 --- a/bin/windows/dynamic-html-petstore.bat +++ b/bin/windows/dynamic-html-petstore.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties -set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l dynamic-html -o samples\client\petstore\dynamic-html +set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.yaml -l dynamic-html -o samples\client\petstore\dynamic-html java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/flash-petstore.bat b/bin/windows/flash-petstore.bat index 9e656642e455..2c069c633020 100755 --- a/bin/windows/flash-petstore.bat +++ b/bin/windows/flash-petstore.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties -set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l flash -o samples\client\petstore\flash +set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.yaml -l flash -o samples\client\petstore\flash java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/go-petstore.bat b/bin/windows/go-petstore.bat index c684f19ed2b8..e6007cca3a13 100755 --- a/bin/windows/go-petstore.bat +++ b/bin/windows/go-petstore.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties -set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l go -o samples\client\petstore\go +set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.yaml -l go -o samples\client\petstore\go java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/html-petstore.bat b/bin/windows/html-petstore.bat index 34c1d8af3ecb..f6ba3d02b675 100755 --- a/bin/windows/html-petstore.bat +++ b/bin/windows/html-petstore.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties -set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l html -o samples\client\petstore\html +set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.yaml -l html -o samples\client\petstore\html java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/java-petstore-okhttp-gson.bat b/bin/windows/java-petstore-okhttp-gson.bat index 0a771bd9bd46..58b3edef39e0 100755 --- a/bin/windows/java-petstore-okhttp-gson.bat +++ b/bin/windows/java-petstore-okhttp-gson.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l java -o samples\client\petstore\java --library=okhttp-gson -DdateLibrary=joda,hideGenerationTimestamp=true +set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.yaml -l java -o samples\client\petstore\java --library=okhttp-gson -DdateLibrary=joda,hideGenerationTimestamp=true java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/java-petstore.bat b/bin/windows/java-petstore.bat index ef508c6590a4..e68f7219914c 100755 --- a/bin/windows/java-petstore.bat +++ b/bin/windows/java-petstore.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l java -o samples\client\petstore\java -DdateLibrary=joda,hideGenerationTimestamp=true +set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.yaml -l java -o samples\client\petstore\java -DdateLibrary=joda,hideGenerationTimestamp=true java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/java-play-framework-petstore-server.bat b/bin/windows/java-play-framework-petstore-server.bat index b2d2604f59c4..058e54e5e796 100644 --- a/bin/windows/java-play-framework-petstore-server.bat +++ b/bin/windows/java-play-framework-petstore-server.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l java-play-framework -o samples\server\petstore\java-play-framework +set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.yaml -l java-play-framework -o samples\server\petstore\java-play-framework java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/jaxrs-cxf-client-petstore.bat b/bin/windows/jaxrs-cxf-client-petstore.bat index fdb4d6ff69a8..88f9b06a9092 100755 --- a/bin/windows/jaxrs-cxf-client-petstore.bat +++ b/bin/windows/jaxrs-cxf-client-petstore.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties -set ags=generate --artifact-id "jaxrs-cxf-client-petstore-client" -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l jaxrs-cxf-client -o samples\client\petstore\jaxrs-cxf-client +set ags=generate --artifact-id "jaxrs-cxf-client-petstore-client" -i modules\swagger-codegen\src\test\resources\2_0\petstore.yaml -l jaxrs-cxf-client -o samples\client\petstore\jaxrs-cxf-client java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/objc-petstore.bat b/bin/windows/objc-petstore.bat index 13c11d2adcdf..0af6b315ee48 100755 --- a/bin/windows/objc-petstore.bat +++ b/bin/windows/objc-petstore.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l objc -o samples\client\petstore\objc\default +set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.yaml -l objc -o samples\client\petstore\objc\default java %JAVA_OPTS% -DappName=PetstoreClient -jar %executable% %ags% diff --git a/bin/windows/perl-petstore.bat b/bin/windows/perl-petstore.bat index d8bd90fd6754..7858a63b1bdb 100755 --- a/bin/windows/perl-petstore.bat +++ b/bin/windows/perl-petstore.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l perl -o samples\client\petstore\perl +set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.yaml -l perl -o samples\client\petstore\perl java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/php-petstore.bat b/bin/windows/php-petstore.bat index 603a33140b74..38f7c22cb111 100755 --- a/bin/windows/php-petstore.bat +++ b/bin/windows/php-petstore.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l php -o samples\client\petstore\php +set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.yaml -l php -o samples\client\petstore\php java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/python-petstore.bat b/bin/windows/python-petstore.bat index 4c3db67398e0..1c5441f216f4 100755 --- a/bin/windows/python-petstore.bat +++ b/bin/windows/python-petstore.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l python -o samples\client\petstore\python +set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.yaml -l python -o samples\client\petstore\python java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/qt5cpp-petstore.bat b/bin/windows/qt5cpp-petstore.bat index 55e8cd417bdd..0448b9da32c2 100755 --- a/bin/windows/qt5cpp-petstore.bat +++ b/bin/windows/qt5cpp-petstore.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l qt5cpp -o samples\client\petstore\qt5cpp +set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.yaml -l qt5cpp -o samples\client\petstore\qt5cpp java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/rails5-petstore-server.bat b/bin/windows/rails5-petstore-server.bat index 8c4df75b87f9..444d3dd59e66 100755 --- a/bin/windows/rails5-petstore-server.bat +++ b/bin/windows/rails5-petstore-server.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l rails5 -o samples\server\petstore\rails5\ +set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.yaml -l rails5 -o samples\server\petstore\rails5\ java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/ruby-petstore.bat b/bin/windows/ruby-petstore.bat index 2c7cfa7d783e..9b0b30370c14 100755 --- a/bin/windows/ruby-petstore.bat +++ b/bin/windows/ruby-petstore.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l ruby -o samples\client\petstore\ruby +set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.yaml -l ruby -o samples\client\petstore\ruby java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/scala-petstore.bat b/bin/windows/scala-petstore.bat index b06be64cc4c1..e825ac76a457 100755 --- a/bin/windows/scala-petstore.bat +++ b/bin/windows/scala-petstore.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l scala -o samples\client\petstore\scala +set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.yaml -l scala -o samples\client\petstore\scala java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/spring-mvc-petstore-j8-async-server.bat b/bin/windows/spring-mvc-petstore-j8-async-server.bat index 4ef8db445684..b9c9745e8d93 100644 --- a/bin/windows/spring-mvc-petstore-j8-async-server.bat +++ b/bin/windows/spring-mvc-petstore-j8-async-server.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l spring --library=spring-mvc -o samples\server\petstore\spring-mvc-j8-async -c bin\spring-mvc-petstore-j8-async.json +set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.yaml -l spring --library=spring-mvc -o samples\server\petstore\spring-mvc-j8-async -c bin\spring-mvc-petstore-j8-async.json java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/spring-mvc-petstore-server.bat b/bin/windows/spring-mvc-petstore-server.bat index 258495f6cd79..18975dead96c 100644 --- a/bin/windows/spring-mvc-petstore-server.bat +++ b/bin/windows/spring-mvc-petstore-server.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l spring --library=spring-mvc -o samples\server\petstore\spring-mvc +set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.yaml -l spring --library=spring-mvc -o samples\server\petstore\spring-mvc java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/springboot-petstore-server.bat b/bin/windows/springboot-petstore-server.bat index 44f100a9f6d6..4a9ca037c3bd 100644 --- a/bin/windows/springboot-petstore-server.bat +++ b/bin/windows/springboot-petstore-server.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l spring -o samples\server\petstore\springboot +set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.yaml -l spring -o samples\server\petstore\springboot java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/swift-petstore-promisekit.bat b/bin/windows/swift-petstore-promisekit.bat index bbd0d4c87b9b..aac92e1cf751 100755 --- a/bin/windows/swift-petstore-promisekit.bat +++ b/bin/windows/swift-petstore-promisekit.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l swift -c bin\swift-petstore-promisekit.json -o samples\client\petstore\swift\promisekit +set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.yaml -l swift -c bin\swift-petstore-promisekit.json -o samples\client\petstore\swift\promisekit java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/swift-petstore-rxswift.bat b/bin/windows/swift-petstore-rxswift.bat index 92d80c3a71bf..a3f271aeb97b 100755 --- a/bin/windows/swift-petstore-rxswift.bat +++ b/bin/windows/swift-petstore-rxswift.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l swift -c bin\swift-petstore-rxswift.json -o samples\client\petstore\swift\rxswift +set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.yaml -l swift -c bin\swift-petstore-rxswift.json -o samples\client\petstore\swift\rxswift java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/swift-petstore.bat b/bin/windows/swift-petstore.bat index 3728a8da8ad5..f3541e4df434 100755 --- a/bin/windows/swift-petstore.bat +++ b/bin/windows/swift-petstore.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l swift -o samples\client\petstore\swift\default +set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.yaml -l swift -o samples\client\petstore\swift\default java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/tizen-petstore.bat b/bin/windows/tizen-petstore.bat index 3da907bd4851..a3199468ea07 100755 --- a/bin/windows/tizen-petstore.bat +++ b/bin/windows/tizen-petstore.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% Xmx1024M -set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l tizen -o samples\client\petstore\tizen +set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.yaml -l tizen -o samples\client\petstore\tizen java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/typescript-angular.bat b/bin/windows/typescript-angular.bat index 26245ef22b11..47e575494f05 100755 --- a/bin/windows/typescript-angular.bat +++ b/bin/windows/typescript-angular.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l typescript-angular -o samples\client\petstore\typescript-angular +set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.yaml -l typescript-angular -o samples\client\petstore\typescript-angular java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/typescript-angular2-with-npm.bat b/bin/windows/typescript-angular2-with-npm.bat index 1d6766a17ecb..0bf7a88ad112 100644 --- a/bin/windows/typescript-angular2-with-npm.bat +++ b/bin/windows/typescript-angular2-with-npm.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -c bin\typescript-petstore-npm.json -l typescript-angular2 -o samples\client\petstore\typescript-angular2\npm +set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.yaml -c bin\typescript-petstore-npm.json -l typescript-angular2 -o samples\client\petstore\typescript-angular2\npm java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/typescript-angular2.bat b/bin/windows/typescript-angular2.bat index a3bff34c87fd..81be77b6bff7 100755 --- a/bin/windows/typescript-angular2.bat +++ b/bin/windows/typescript-angular2.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l typescript-angular2 -o samples\client\petstore\typescript-angular2\default +set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.yaml -l typescript-angular2 -o samples\client\petstore\typescript-angular2\default java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/typescript-fetch.bat b/bin/windows/typescript-fetch.bat index 9d78c6f754a3..a2b45b399016 100755 --- a/bin/windows/typescript-fetch.bat +++ b/bin/windows/typescript-fetch.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l typescript-fetch -o samples\client\petstore\typescript-fetch +set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.yaml -l typescript-fetch -o samples\client\petstore\typescript-fetch java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/typescript-node-with-npm.bat b/bin/windows/typescript-node-with-npm.bat index d33958637bb8..0afe3aaf0118 100755 --- a/bin/windows/typescript-node-with-npm.bat +++ b/bin/windows/typescript-node-with-npm.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -c bin\typescript-petstore-npm.json -l typescript-node -o samples\client\petstore\typescript-node\npm +set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.yaml -c bin\typescript-petstore-npm.json -l typescript-node -o samples\client\petstore\typescript-node\npm java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/typescript-node.bat b/bin/windows/typescript-node.bat index f756deafb7b6..eacb7bad78ed 100755 --- a/bin/windows/typescript-node.bat +++ b/bin/windows/typescript-node.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l typescript-node -o samples\client\petstore\typescript-node\default +set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.yaml -l typescript-node -o samples\client\petstore\typescript-node\default java %JAVA_OPTS% -jar %executable% %ags% diff --git a/modules/swagger-codegen-cli/src/main/java/io/swagger/codegen/SwaggerCodegen.java b/modules/swagger-codegen-cli/src/main/java/io/swagger/codegen/SwaggerCodegen.java index 94b64be8d021..1b73ec6e98cd 100644 --- a/modules/swagger-codegen-cli/src/main/java/io/swagger/codegen/SwaggerCodegen.java +++ b/modules/swagger-codegen-cli/src/main/java/io/swagger/codegen/SwaggerCodegen.java @@ -6,6 +6,7 @@ import io.swagger.codegen.cmd.ConfigHelp; import io.swagger.codegen.cmd.Generate; import io.swagger.codegen.cmd.Langs; import io.swagger.codegen.cmd.Meta; +import io.swagger.codegen.cmd.Validate; import io.swagger.codegen.cmd.Version; /** @@ -35,6 +36,7 @@ public class SwaggerCodegen { Langs.class, Help.class, ConfigHelp.class, + Validate.class, Version.class ); diff --git a/modules/swagger-codegen-cli/src/main/java/io/swagger/codegen/cmd/Validate.java b/modules/swagger-codegen-cli/src/main/java/io/swagger/codegen/cmd/Validate.java new file mode 100644 index 000000000000..832e008f282a --- /dev/null +++ b/modules/swagger-codegen-cli/src/main/java/io/swagger/codegen/cmd/Validate.java @@ -0,0 +1,37 @@ +package io.swagger.codegen.cmd; + +import io.airlift.airline.Command; +import io.airlift.airline.Option; + +import io.swagger.parser.SwaggerParser; +import io.swagger.parser.util.SwaggerDeserializationResult; + +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +@Command(name = "validate", description = "Validate specification") +public class Validate implements Runnable { + + @Option(name = {"-i", "--input-spec"}, title = "spec file", required = true, + description = "location of the swagger spec, as URL or file (required)") + private String spec; + + @Override + public void run() { + System.out.println("Validating spec file (" + spec + ")"); + + SwaggerParser parser = new SwaggerParser(); + SwaggerDeserializationResult result = parser.readWithInfo(spec, null, true); + List messageList = result.getMessages(); + Set messages = new HashSet(messageList); + + for (String message: messages) { + System.out.println(message); + } + + if (messages.size() > 0) { + throw new ValidateException(); + } + } +} \ No newline at end of file diff --git a/modules/swagger-codegen-cli/src/main/java/io/swagger/codegen/cmd/ValidateException.java b/modules/swagger-codegen-cli/src/main/java/io/swagger/codegen/cmd/ValidateException.java new file mode 100644 index 000000000000..f1715827ba92 --- /dev/null +++ b/modules/swagger-codegen-cli/src/main/java/io/swagger/codegen/cmd/ValidateException.java @@ -0,0 +1,7 @@ +package io.swagger.codegen.cmd; + +/** + * Created by takuro on 2017/05/02. + */ +public class ValidateException extends RuntimeException { +} diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java index bb3817896f17..b5d83c1e5416 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java @@ -48,6 +48,7 @@ import io.swagger.models.properties.RefProperty; import io.swagger.models.properties.StringProperty; import io.swagger.models.properties.UUIDProperty; import io.swagger.util.Json; +import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.StringEscapeUtils; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; @@ -2688,9 +2689,23 @@ public class DefaultCodegen { } } - sec.hasMore = it.hasNext(); secs.add(sec); } + + // sort auth methods to maintain the same order + Collections.sort(secs, new Comparator() { + @Override + public int compare(CodegenSecurity one, CodegenSecurity another) { + return ObjectUtils.compare(one.name, another.name); + } + }); + // set 'hasMore' + Iterator it = secs.iterator(); + while (it.hasNext()) { + final CodegenSecurity security = it.next(); + security.hasMore = it.hasNext(); + } + return secs; } diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultGenerator.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultGenerator.java index 728b95788978..886f8fdc0976 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultGenerator.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultGenerator.java @@ -625,13 +625,6 @@ public class DefaultGenerator extends AbstractGenerator implements Generator { bundle.put("modelPackage", config.modelPackage()); List authMethods = config.fromSecurity(swagger.getSecurityDefinitions()); if (authMethods != null && !authMethods.isEmpty()) { - // sort auth methods to maintain the same order - Collections.sort(authMethods, new Comparator() { - @Override - public int compare(CodegenSecurity one, CodegenSecurity another) { - return ObjectUtils.compare(one.name, another.name); - } - }); bundle.put("authMethods", authMethods); bundle.put("hasAuthMethods", true); } diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/Qt5CPPGenerator.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/Qt5CPPGenerator.java index 6d8ae7426fe9..89c77195ed10 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/Qt5CPPGenerator.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/Qt5CPPGenerator.java @@ -1,9 +1,6 @@ package io.swagger.codegen.languages; -import io.swagger.codegen.CodegenConfig; -import io.swagger.codegen.CodegenType; -import io.swagger.codegen.DefaultCodegen; -import io.swagger.codegen.SupportingFile; +import io.swagger.codegen.*; import io.swagger.models.properties.ArrayProperty; import io.swagger.models.properties.BooleanProperty; import io.swagger.models.properties.DateProperty; @@ -27,6 +24,9 @@ import java.util.Map; import java.util.Set; public class Qt5CPPGenerator extends DefaultCodegen implements CodegenConfig { + public static final String CPP_NAMESPACE = "cppNamespace"; + public static final String CPP_NAMESPACE_DESC = "C++ namespace (convention: name::space::for::api)."; + protected final String PREFIX = "SWG"; protected Set foundationClasses = new HashSet(); // source folder where to write the files @@ -34,6 +34,7 @@ public class Qt5CPPGenerator extends DefaultCodegen implements CodegenConfig { protected String apiVersion = "1.0.0"; protected Map namespaces = new HashMap(); protected Set systemIncludes = new HashSet(); + protected String cppNamespace = "Swagger"; public Qt5CPPGenerator() { super(); @@ -74,6 +75,9 @@ public class Qt5CPPGenerator extends DefaultCodegen implements CodegenConfig { */ embeddedTemplateDir = templateDir = "qt5cpp"; + // CLI options + addOption(CPP_NAMESPACE, CPP_NAMESPACE_DESC, this.cppNamespace); + /* * Reserved words. Override this with reserved words specific to your language */ @@ -90,6 +94,11 @@ public class Qt5CPPGenerator extends DefaultCodegen implements CodegenConfig { additionalProperties.put("apiVersion", apiVersion); additionalProperties().put("prefix", PREFIX); + // Write defaults namespace in properties so that it can be accessible in templates. + // At this point command line has not been parsed so if value is given + // in command line it will superseed this content + additionalProperties.put("cppNamespace",cppNamespace); + /* * Language Specific Primitives. These types will not trigger imports by * the client generator @@ -148,6 +157,24 @@ public class Qt5CPPGenerator extends DefaultCodegen implements CodegenConfig { systemIncludes.add("QByteArray"); } + protected void addOption(String key, String description, String defaultValue) { + CliOption option = new CliOption(key, description); + if (defaultValue != null) + option.defaultValue(defaultValue); + cliOptions.add(option); + } + + @Override + public void processOpts() { + super.processOpts(); + + if (additionalProperties.containsKey("cppNamespace")){ + cppNamespace = (String) additionalProperties.get("cppNamespace"); + } + + additionalProperties.put("cppNamespaceDeclarations", cppNamespace.split("\\::")); + } + /** * Configures the type of generator. * @@ -203,7 +230,7 @@ public class Qt5CPPGenerator extends DefaultCodegen implements CodegenConfig { * @return the escaped term */ @Override - public String escapeReservedWord(String name) { + public String escapeReservedWord(String name) { if(this.reservedWordsMappings().containsKey(name)) { return this.reservedWordsMappings().get(name); } @@ -266,6 +293,7 @@ public class Qt5CPPGenerator extends DefaultCodegen implements CodegenConfig { } } + @Override public String toDefaultValue(Property p) { if (p instanceof StringProperty) { @@ -310,7 +338,6 @@ public class Qt5CPPGenerator extends DefaultCodegen implements CodegenConfig { return "NULL"; } - /** * 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. diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/Swift3Codegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/Swift3Codegen.java index 86ac4963645f..65297b999776 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/Swift3Codegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/Swift3Codegen.java @@ -5,6 +5,7 @@ import com.google.common.collect.Iterators; import com.google.common.collect.Lists; import io.swagger.codegen.*; import io.swagger.models.Model; +import io.swagger.models.ModelImpl; import io.swagger.models.Operation; import io.swagger.models.Swagger; import io.swagger.models.parameters.HeaderParameter; @@ -62,6 +63,16 @@ public class Swift3Codegen extends DefaultCodegen implements CodegenConfig { return "Generates a swift client library."; } + @Override + protected void addAdditionPropertiesToCodeGenModel(CodegenModel codegenModel, ModelImpl swaggerModel) { + + final Property additionalProperties = swaggerModel.getAdditionalProperties(); + + if(additionalProperties != null) { + codegenModel.additionalPropertiesType = getSwaggerType(additionalProperties); + } + } + public Swift3Codegen() { super(); outputFolder = "generated-code" + File.separator + "swift"; @@ -348,7 +359,7 @@ public class Swift3Codegen extends DefaultCodegen implements CodegenConfig { if (p instanceof MapProperty) { MapProperty ap = (MapProperty) p; String inner = getSwaggerType(ap.getAdditionalProperties()); - return "[String:" + inner + "]"; + return inner; } else if (p instanceof ArrayProperty) { ArrayProperty ap = (ArrayProperty) p; String inner = getSwaggerType(ap.getItems()); diff --git a/modules/swagger-codegen/src/main/resources/Java/pojo.mustache b/modules/swagger-codegen/src/main/resources/Java/pojo.mustache index a6b4548d085b..8b137a0259a2 100644 --- a/modules/swagger-codegen/src/main/resources/Java/pojo.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/pojo.mustache @@ -178,17 +178,12 @@ public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#parcela {{classname}}(Parcel in) { {{#parent}} super(in); {{/parent}} {{#vars}} - {{#isContainer}} - {{#complexType}} + {{#isPrimitiveType}} + {{name}} = ({{{datatypeWithEnum}}})in.readValue(null); + {{/isPrimitiveType}} + {{^isPrimitiveType}} {{name}} = ({{{datatypeWithEnum}}})in.readValue({{complexType}}.class.getClassLoader()); - {{/complexType}} - {{^complexType}} - {{name}} = ({{{datatypeWithEnum}}})in.readValue(null); - {{/complexType}} - {{/isContainer}} - {{^isContainer}} - {{name}} = ({{{datatypeWithEnum}}})in.readValue(null); - {{/isContainer}} + {{/isPrimitiveType}} {{/vars}} } diff --git a/modules/swagger-codegen/src/main/resources/Java/typeInfoAnnotation.mustache b/modules/swagger-codegen/src/main/resources/Java/typeInfoAnnotation.mustache index b3083e788d90..2d7983d01019 100644 --- a/modules/swagger-codegen/src/main/resources/Java/typeInfoAnnotation.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/typeInfoAnnotation.mustache @@ -2,6 +2,6 @@ @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "{{discriminator}}", visible = true ) @JsonSubTypes({ {{#children}} - @JsonSubTypes.Type(value = {{name}}.class, name = "{{^vendorExtensions.x-discriminator-value}}{{name}}{{/vendorExtensions.x-discriminator-value}}{{#vendorExtensions.x-discriminator-value}}{{{vendorExtensions.x-discriminator-value}}}{{/vendorExtensions.x-discriminator-value}}"), + @JsonSubTypes.Type(value = {{classname}}.class, name = "{{^vendorExtensions.x-discriminator-value}}{{name}}{{/vendorExtensions.x-discriminator-value}}{{#vendorExtensions.x-discriminator-value}}{{{vendorExtensions.x-discriminator-value}}}{{/vendorExtensions.x-discriminator-value}}"), {{/children}} }){{/jackson}} diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jacksonJsonProvider.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/jacksonJsonProvider.mustache index e82da4051f74..5fa284e809ed 100644 --- a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jacksonJsonProvider.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/jacksonJsonProvider.mustache @@ -3,7 +3,14 @@ package {{apiPackage}}; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; -import com.fasterxml.jackson.datatype.joda.JodaModule; + +{{#java8}} +import com.fasterxml.jackson.datatype.jsr310.*; +{{/java8}} +{{^java8}} +import com.fasterxml.jackson.datatype.joda.*; +{{/java8}} + import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider; import javax.ws.rs.Produces; @@ -19,7 +26,12 @@ public class JacksonJsonProvider extends JacksonJaxbJsonProvider { ObjectMapper objectMapper = new ObjectMapper() .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) +{{#java8}} + .registerModule(new JavaTimeModule()) +{{/java8}} +{{^java8}} .registerModule(new JodaModule()) +{{/java8}} .setDateFormat(new RFC3339DateFormat()); setMapper(objectMapper); diff --git a/modules/swagger-codegen/src/main/resources/python/api.mustache b/modules/swagger-codegen/src/main/resources/python/api.mustache index a07b92e6c5ce..354bb6fd66ba 100644 --- a/modules/swagger-codegen/src/main/resources/python/api.mustache +++ b/modules/swagger-codegen/src/main/resources/python/api.mustache @@ -155,10 +155,10 @@ class {{classname}}(object): collection_formats['{{baseName}}'] = '{{collectionFormat}}'{{/isListContainer}} {{/pathParams}} - query_params = {} + query_params = [] {{#queryParams}} if '{{paramName}}' in params: - query_params['{{baseName}}'] = params['{{paramName}}']{{#isListContainer}} + query_params.append(('{{baseName}}', params['{{paramName}}'])){{#isListContainer}} collection_formats['{{baseName}}'] = '{{collectionFormat}}'{{/isListContainer}} {{/queryParams}} diff --git a/modules/swagger-codegen/src/main/resources/qt5cpp/HttpRequest.cpp.mustache b/modules/swagger-codegen/src/main/resources/qt5cpp/HttpRequest.cpp.mustache index 33d7d4909935..3efdde28cc39 100644 --- a/modules/swagger-codegen/src/main/resources/qt5cpp/HttpRequest.cpp.mustache +++ b/modules/swagger-codegen/src/main/resources/qt5cpp/HttpRequest.cpp.mustache @@ -6,6 +6,10 @@ #include +{{#cppNamespaceDeclarations}} +namespace {{this}} { +{{/cppNamespaceDeclarations}} + HttpRequestInput::HttpRequestInput() { initialize(); } @@ -298,3 +302,7 @@ void HttpRequestWorker::on_manager_finished(QNetworkReply *reply) { emit on_execution_finished(this); } + +{{#cppNamespaceDeclarations}} +} +{{/cppNamespaceDeclarations}} diff --git a/modules/swagger-codegen/src/main/resources/qt5cpp/HttpRequest.h.mustache b/modules/swagger-codegen/src/main/resources/qt5cpp/HttpRequest.h.mustache index d03e671e2515..71beb69d41fc 100644 --- a/modules/swagger-codegen/src/main/resources/qt5cpp/HttpRequest.h.mustache +++ b/modules/swagger-codegen/src/main/resources/qt5cpp/HttpRequest.h.mustache @@ -16,6 +16,9 @@ enum HttpRequestVarLayout {NOT_SET, ADDRESS, URL_ENCODED, MULTIPART}; +{{#cppNamespaceDeclarations}} +namespace {{this}} { +{{/cppNamespaceDeclarations}} class SWGHttpRequestInputFileElement { @@ -73,4 +76,8 @@ private slots: }; +{{#cppNamespaceDeclarations}} +} +{{/cppNamespaceDeclarations}} + #endif // HTTPREQUESTWORKER_H diff --git a/modules/swagger-codegen/src/main/resources/qt5cpp/api-body.mustache b/modules/swagger-codegen/src/main/resources/qt5cpp/api-body.mustache index e0644395403f..63f88d55911c 100644 --- a/modules/swagger-codegen/src/main/resources/qt5cpp/api-body.mustache +++ b/modules/swagger-codegen/src/main/resources/qt5cpp/api-body.mustache @@ -6,7 +6,10 @@ #include #include -namespace Swagger { +{{#cppNamespaceDeclarations}} +namespace {{this}} { +{{/cppNamespaceDeclarations}} + {{classname}}::{{classname}}() {} {{classname}}::~{{classname}}() {} @@ -178,4 +181,7 @@ void } {{/operation}} {{/operations}} -} /* namespace Swagger */ + +{{#cppNamespaceDeclarations}} +} +{{/cppNamespaceDeclarations}} diff --git a/modules/swagger-codegen/src/main/resources/qt5cpp/api-header.mustache b/modules/swagger-codegen/src/main/resources/qt5cpp/api-header.mustache index 53b7271c8d54..91868201b9e3 100644 --- a/modules/swagger-codegen/src/main/resources/qt5cpp/api-header.mustache +++ b/modules/swagger-codegen/src/main/resources/qt5cpp/api-header.mustache @@ -9,7 +9,9 @@ #include -namespace Swagger { +{{#cppNamespaceDeclarations}} +namespace {{this}} { +{{/cppNamespaceDeclarations}} class {{classname}}: public QObject { Q_OBJECT @@ -31,5 +33,8 @@ signals: {{#operations}}{{#operation}}void {{nickname}}Signal({{#returnType}}{{{returnType}}} summary{{/returnType}}); {{/operation}}{{/operations}} }; + +{{#cppNamespaceDeclarations}} } +{{/cppNamespaceDeclarations}} #endif diff --git a/modules/swagger-codegen/src/main/resources/qt5cpp/helpers-body.mustache b/modules/swagger-codegen/src/main/resources/qt5cpp/helpers-body.mustache index 0c1e37aeff8f..e0f2f09a309e 100644 --- a/modules/swagger-codegen/src/main/resources/qt5cpp/helpers-body.mustache +++ b/modules/swagger-codegen/src/main/resources/qt5cpp/helpers-body.mustache @@ -7,7 +7,10 @@ #include #include -namespace Swagger { + +{{#cppNamespaceDeclarations}} +namespace {{this}} { +{{/cppNamespaceDeclarations}} void setValue(void* value, QJsonValue obj, QString type, QString complexType) { @@ -119,7 +122,7 @@ setValue(void* value, QJsonValue obj, QString type, QString complexType) { else if(type.startsWith("SWG") && obj.isObject()) { // complex type QJsonObject jsonObj = obj.toObject(); - SWGObject * so = (SWGObject*)Swagger::create(type); + SWGObject * so = (SWGObject*)::{{cppNamespace}}::create(type); if(so != nullptr) { so->fromJsonObject(jsonObj); SWGObject **val = static_cast(value); @@ -279,4 +282,7 @@ QString stringValue(bool value) { return QString(value ? "true" : "false"); } -} /* namespace Swagger */ + +{{#cppNamespaceDeclarations}} +} +{{/cppNamespaceDeclarations}} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/qt5cpp/helpers-header.mustache b/modules/swagger-codegen/src/main/resources/qt5cpp/helpers-header.mustache index c61f4554f740..3eb4f9a9d47e 100644 --- a/modules/swagger-codegen/src/main/resources/qt5cpp/helpers-header.mustache +++ b/modules/swagger-codegen/src/main/resources/qt5cpp/helpers-header.mustache @@ -4,7 +4,10 @@ #include -namespace Swagger { +{{#cppNamespaceDeclarations}} +namespace {{this}} { +{{/cppNamespaceDeclarations}} + void setValue(void* value, QJsonValue obj, QString type, QString complexType); void toJsonArray(QList* value, QJsonArray* output, QString innerName, QString innerType); void toJsonValue(QString name, void* value, QJsonObject* output, QString type); @@ -13,6 +16,9 @@ namespace Swagger { QString stringValue(qint32 value); QString stringValue(qint64 value); QString stringValue(bool value); + +{{#cppNamespaceDeclarations}} } +{{/cppNamespaceDeclarations}} #endif // SWGHELPERS_H diff --git a/modules/swagger-codegen/src/main/resources/qt5cpp/model-body.mustache b/modules/swagger-codegen/src/main/resources/qt5cpp/model-body.mustache index a5dd2578e204..ba23d2e61f35 100644 --- a/modules/swagger-codegen/src/main/resources/qt5cpp/model-body.mustache +++ b/modules/swagger-codegen/src/main/resources/qt5cpp/model-body.mustache @@ -9,8 +9,9 @@ #include #include -namespace Swagger { - +{{#cppNamespaceDeclarations}} +namespace {{this}} { +{{/cppNamespaceDeclarations}} {{classname}}::{{classname}}(QString* json) { init(); @@ -57,10 +58,10 @@ void void {{classname}}::fromJsonObject(QJsonObject &pJson) { {{#vars}} - {{^isContainer}}::Swagger::setValue(&{{name}}, pJson["{{baseName}}"], "{{baseType}}", "{{complexType}}");{{/isContainer}} + {{^isContainer}}::{{cppNamespace}}::setValue(&{{name}}, pJson["{{baseName}}"], "{{baseType}}", "{{complexType}}");{{/isContainer}} {{#isContainer}} - {{#complexType}}::Swagger::setValue(&{{name}}, pJson["{{baseName}}"], "{{baseType}}", "{{complexType}}");{{/complexType}} - {{^complexType}}::Swagger::setValue(&{{name}}, pJson["{{baseName}}"], "{{baseType}}", "{{items.baseType}}");{{/complexType}} + {{#complexType}}::{{cppNamespace}}::setValue(&{{name}}, pJson["{{baseName}}"], "{{baseType}}", "{{complexType}}");{{/complexType}} + {{^complexType}}::{{cppNamespace}}::setValue(&{{name}}, pJson["{{baseName}}"], "{{baseType}}", "{{items.baseType}}");{{/complexType}} {{/isContainer}} {{/vars}} } @@ -107,8 +108,9 @@ void {{/vars}} - -} /* namespace Swagger */ +{{#cppNamespaceDeclarations}} +} +{{/cppNamespaceDeclarations}} {{/model}} {{/models}} diff --git a/modules/swagger-codegen/src/main/resources/qt5cpp/model-header.mustache b/modules/swagger-codegen/src/main/resources/qt5cpp/model-header.mustache index 49d50d0daefd..0a55f3aab241 100644 --- a/modules/swagger-codegen/src/main/resources/qt5cpp/model-header.mustache +++ b/modules/swagger-codegen/src/main/resources/qt5cpp/model-header.mustache @@ -17,7 +17,9 @@ #include "SWGObject.h" {{#models}}{{#model}} -namespace Swagger { +{{#cppNamespaceDeclarations}} +namespace {{this}} { +{{/cppNamespaceDeclarations}} class {{classname}}: public SWGObject { public: @@ -44,7 +46,9 @@ private: {{/vars}} }; -} /* namespace Swagger */ +{{#cppNamespaceDeclarations}} +} +{{/cppNamespaceDeclarations}} #endif /* {{classname}}_H_ */ {{/model}} diff --git a/modules/swagger-codegen/src/main/resources/qt5cpp/model.mustache b/modules/swagger-codegen/src/main/resources/qt5cpp/model.mustache index 64cb203e4c6a..4d3590b8afe2 100644 --- a/modules/swagger-codegen/src/main/resources/qt5cpp/model.mustache +++ b/modules/swagger-codegen/src/main/resources/qt5cpp/model.mustache @@ -22,7 +22,10 @@ using namespace Tizen::Web::Json; {{/imports}} {{#models}}{{#model}} -namespace Swagger { + +{{#cppNamespaceDeclarations}} +namespace {{this}} { +{{/cppNamespaceDeclarations}} class {{classname}}: public {{prefix}}Object { public: @@ -52,7 +55,9 @@ private: {{/vars}} }; -} /* namespace Swagger */ +{{#cppNamespaceDeclarations}} +} +{{/cppNamespaceDeclarations}} #endif /* {{classname}}_H_ */ {{/model}} diff --git a/modules/swagger-codegen/src/main/resources/qt5cpp/modelFactory.mustache b/modules/swagger-codegen/src/main/resources/qt5cpp/modelFactory.mustache index 8859fe7db326..d4643363a5a9 100644 --- a/modules/swagger-codegen/src/main/resources/qt5cpp/modelFactory.mustache +++ b/modules/swagger-codegen/src/main/resources/qt5cpp/modelFactory.mustache @@ -5,7 +5,10 @@ {{#models}}{{#model}} #include "{{classname}}.h"{{/model}}{{/models}} -namespace Swagger { +{{#cppNamespaceDeclarations}} +namespace {{this}} { +{{/cppNamespaceDeclarations}} + inline void* create(QString type) { {{#models}}{{#model}}if(QString("{{classname}}").compare(type) == 0) { return new {{classname}}(); @@ -25,6 +28,9 @@ namespace Swagger { } return nullptr; } -} /* namespace Swagger */ + +{{#cppNamespaceDeclarations}} +} +{{/cppNamespaceDeclarations}} #endif /* ModelFactory_H_ */ diff --git a/modules/swagger-codegen/src/main/resources/qt5cpp/object.mustache b/modules/swagger-codegen/src/main/resources/qt5cpp/object.mustache index 62b9975d84ea..53b7181b14de 100644 --- a/modules/swagger-codegen/src/main/resources/qt5cpp/object.mustache +++ b/modules/swagger-codegen/src/main/resources/qt5cpp/object.mustache @@ -4,6 +4,10 @@ #include +{{#cppNamespaceDeclarations}} +namespace {{this}} { +{{/cppNamespaceDeclarations}} + class {{prefix}}Object { public: virtual QJsonObject* asJsonObject() { @@ -22,4 +26,8 @@ class {{prefix}}Object { } }; +{{#cppNamespaceDeclarations}} +} +{{/cppNamespaceDeclarations}} + #endif /* _{{prefix}}_OBJECT_H_ */ diff --git a/modules/swagger-codegen/src/main/resources/ruby/api.mustache b/modules/swagger-codegen/src/main/resources/ruby/api.mustache index fc9d29056353..6628e40cb5cb 100644 --- a/modules/swagger-codegen/src/main/resources/ruby/api.mustache +++ b/modules/swagger-codegen/src/main/resources/ruby/api.mustache @@ -38,11 +38,13 @@ module {{moduleName}} {{#allParams}} {{#required}} # verify the required parameter '{{paramName}}' is set - fail ArgumentError, "Missing the required parameter '{{paramName}}' when calling {{classname}}.{{operationId}}" if {{{paramName}}}.nil? + if @api_client.config.client_side_validation && {{{paramName}}}.nil? + fail ArgumentError, "Missing the required parameter '{{paramName}}' when calling {{classname}}.{{operationId}}" + end {{#isEnum}} {{^isContainer}} # verify enum value - unless [{{#allowableValues}}{{#values}}'{{{this}}}'{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}].include?({{{paramName}}}) + if @api_client.config.client_side_validation && ![{{#allowableValues}}{{#values}}'{{{this}}}'{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}].include?({{{paramName}}}) fail ArgumentError, "invalid value for '{{{paramName}}}', must be one of {{#allowableValues}}{{#values}}{{{this}}}{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}" end {{/isContainer}} @@ -51,12 +53,12 @@ module {{moduleName}} {{^required}} {{#isEnum}} {{#collectionFormat}} - if opts[:'{{{paramName}}}'] && !opts[:'{{{paramName}}}'].all?{|item| [{{#allowableValues}}{{#values}}'{{{this}}}'{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}].include?(item)} + if @api_client.config.client_side_validation && opts[:'{{{paramName}}}'] && !opts[:'{{{paramName}}}'].all?{|item| [{{#allowableValues}}{{#values}}'{{{this}}}'{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}].include?(item)} fail ArgumentError, 'invalid value for "{{{paramName}}}", must include one of {{#allowableValues}}{{#values}}{{{this}}}{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}' end {{/collectionFormat}} {{^collectionFormat}} - if opts[:'{{{paramName}}}'] && ![{{#allowableValues}}{{#values}}'{{{this}}}'{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}].include?(opts[:'{{{paramName}}}']) + if @api_client.config.client_side_validation && opts[:'{{{paramName}}}'] && ![{{#allowableValues}}{{#values}}'{{{this}}}'{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}].include?(opts[:'{{{paramName}}}']) fail ArgumentError, 'invalid value for "{{{paramName}}}", must be one of {{#allowableValues}}{{#values}}{{{this}}}{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}' end {{/collectionFormat}} @@ -64,43 +66,43 @@ module {{moduleName}} {{/required}} {{#hasValidation}} {{#maxLength}} - if {{^required}}!opts[:'{{{paramName}}}'].nil? && {{/required}}{{#required}}{{{paramName}}}{{/required}}{{^required}}opts[:'{{{paramName}}}']{{/required}}.to_s.length > {{{maxLength}}} + if @api_client.config.client_side_validation && {{^required}}!opts[:'{{{paramName}}}'].nil? && {{/required}}{{#required}}{{{paramName}}}{{/required}}{{^required}}opts[:'{{{paramName}}}']{{/required}}.to_s.length > {{{maxLength}}} fail ArgumentError, 'invalid value for "{{#required}}{{{paramName}}}{{/required}}{{^required}}opts[:"{{{paramName}}}"]{{/required}}" when calling {{classname}}.{{operationId}}, the character length must be smaller than or equal to {{{maxLength}}}.' end {{/maxLength}} {{#minLength}} - if {{^required}}!opts[:'{{{paramName}}}'].nil? && {{/required}}{{#required}}{{{paramName}}}{{/required}}{{^required}}opts[:'{{{paramName}}}']{{/required}}.to_s.length < {{{minLength}}} + if @api_client.config.client_side_validation && {{^required}}!opts[:'{{{paramName}}}'].nil? && {{/required}}{{#required}}{{{paramName}}}{{/required}}{{^required}}opts[:'{{{paramName}}}']{{/required}}.to_s.length < {{{minLength}}} fail ArgumentError, 'invalid value for "{{#required}}{{{paramName}}}{{/required}}{{^required}}opts[:"{{{paramName}}}"]{{/required}}" when calling {{classname}}.{{operationId}}, the character length must be great than or equal to {{{minLength}}}.' end {{/minLength}} {{#maximum}} - if {{^required}}!opts[:'{{{paramName}}}'].nil? && {{/required}}{{#required}}{{{paramName}}}{{/required}}{{^required}}opts[:'{{{paramName}}}']{{/required}} >{{#exclusiveMaximum}}={{/exclusiveMaximum}} {{{maximum}}} + if @api_client.config.client_side_validation && {{^required}}!opts[:'{{{paramName}}}'].nil? && {{/required}}{{#required}}{{{paramName}}}{{/required}}{{^required}}opts[:'{{{paramName}}}']{{/required}} >{{#exclusiveMaximum}}={{/exclusiveMaximum}} {{{maximum}}} fail ArgumentError, 'invalid value for "{{#required}}{{{paramName}}}{{/required}}{{^required}}opts[:"{{{paramName}}}"]{{/required}}" when calling {{classname}}.{{operationId}}, must be smaller than {{^exclusiveMaximum}}or equal to {{/exclusiveMaximum}}{{{maximum}}}.' end {{/maximum}} {{#minimum}} - if {{^required}}!opts[:'{{{paramName}}}'].nil? && {{/required}}{{#required}}{{{paramName}}}{{/required}}{{^required}}opts[:'{{{paramName}}}']{{/required}} <{{#exclusiveMinimum}}={{/exclusiveMinimum}} {{{minimum}}} + if @api_client.config.client_side_validation && {{^required}}!opts[:'{{{paramName}}}'].nil? && {{/required}}{{#required}}{{{paramName}}}{{/required}}{{^required}}opts[:'{{{paramName}}}']{{/required}} <{{#exclusiveMinimum}}={{/exclusiveMinimum}} {{{minimum}}} fail ArgumentError, 'invalid value for "{{#required}}{{{paramName}}}{{/required}}{{^required}}opts[:"{{{paramName}}}"]{{/required}}" when calling {{classname}}.{{operationId}}, must be greater than {{^exclusiveMinimum}}or equal to {{/exclusiveMinimum}}{{{minimum}}}.' end {{/minimum}} {{#pattern}} - if {{^required}}!opts[:'{{{paramName}}}'].nil? && {{/required}}{{#required}}{{{paramName}}}{{/required}}{{^required}}opts[:'{{{paramName}}}']{{/required}} !~ Regexp.new({{{pattern}}}) + if @api_client.config.client_side_validation && {{^required}}!opts[:'{{{paramName}}}'].nil? && {{/required}}{{#required}}{{{paramName}}}{{/required}}{{^required}}opts[:'{{{paramName}}}']{{/required}} !~ Regexp.new({{{pattern}}}) fail ArgumentError, "invalid value for '{{#required}}{{{paramName}}}{{/required}}{{^required}}opts[:\"{{{paramName}}}\"]{{/required}}' when calling {{classname}}.{{operationId}}, must conform to the pattern {{{pattern}}}." end {{/pattern}} {{#maxItems}} - if {{^required}}!opts[:'{{{paramName}}}'].nil? && {{/required}}{{#required}}{{{paramName}}}{{/required}}{{^required}}opts[:'{{{paramName}}}']{{/required}}.length > {{{maxItems}}} + if @api_client.config.client_side_validation && {{^required}}!opts[:'{{{paramName}}}'].nil? && {{/required}}{{#required}}{{{paramName}}}{{/required}}{{^required}}opts[:'{{{paramName}}}']{{/required}}.length > {{{maxItems}}} fail ArgumentError, 'invalid value for "{{#required}}{{{paramName}}}{{/required}}{{^required}}opts[:"{{{paramName}}}"]{{/required}}" when calling {{classname}}.{{operationId}}, number of items must be less than or equal to {{{maxItems}}}.' end {{/maxItems}} {{#minItems}} - if {{^required}}!opts[:'{{{paramName}}}'].nil? && {{/required}}{{#required}}{{{paramName}}}{{/required}}{{^required}}opts[:'{{{paramName}}}']{{/required}}.length < {{{minItems}}} + if @api_client.config.client_side_validation && {{^required}}!opts[:'{{{paramName}}}'].nil? && {{/required}}{{#required}}{{{paramName}}}{{/required}}{{^required}}opts[:'{{{paramName}}}']{{/required}}.length < {{{minItems}}} fail ArgumentError, 'invalid value for "{{#required}}{{{paramName}}}{{/required}}{{^required}}opts[:"{{{paramName}}}"]{{/required}}" when calling {{classname}}.{{operationId}}, number of items must be greater than or equal to {{{minItems}}}.' end diff --git a/modules/swagger-codegen/src/main/resources/ruby/configuration.mustache b/modules/swagger-codegen/src/main/resources/ruby/configuration.mustache index 3d160d46511e..faf4d7522629 100644 --- a/modules/swagger-codegen/src/main/resources/ruby/configuration.mustache +++ b/modules/swagger-codegen/src/main/resources/ruby/configuration.mustache @@ -68,6 +68,11 @@ module {{moduleName}} # Default to 0 (never times out). attr_accessor :timeout + # Set this to false to skip client side validation in the operation. + # Default to true. + # @return [true, false] + attr_accessor :client_side_validation + ### TLS/SSL setting # Set this to false to skip verifying SSL certificate when calling API from https server. # Default to true. @@ -121,6 +126,7 @@ module {{moduleName}} @api_key = {} @api_key_prefix = {} @timeout = 0 + @client_side_validation = true @verify_ssl = true @verify_ssl_host = true @params_encoding = nil diff --git a/modules/swagger-codegen/src/main/resources/ruby/gemspec.mustache b/modules/swagger-codegen/src/main/resources/ruby/gemspec.mustache index 8db1dfadabbe..a6617ac8547a 100644 --- a/modules/swagger-codegen/src/main/resources/ruby/gemspec.mustache +++ b/modules/swagger-codegen/src/main/resources/ruby/gemspec.mustache @@ -34,7 +34,7 @@ Gem::Specification.new do |s| s.add_development_dependency 'autotest', '~> 4.4', '>= 4.4.6' s.add_development_dependency 'autotest-rails-pure', '~> 4.1', '>= 4.1.2' s.add_development_dependency 'autotest-growl', '~> 0.2', '>= 0.2.16' - s.add_development_dependency 'autotest-fsevent', '~> 0.2', '>= 0.2.11' + s.add_development_dependency 'autotest-fsevent', '~> 0.2', '>= 0.2.12' s.files = `find *`.split("\n").uniq.sort.select{|f| !f.empty? } s.test_files = `find spec/*`.split("\n") diff --git a/modules/swagger-codegen/src/main/resources/swift3/Models.mustache b/modules/swagger-codegen/src/main/resources/swift3/Models.mustache index a970be0714ae..b61de1b3131b 100644 --- a/modules/swagger-codegen/src/main/resources/swift3/Models.mustache +++ b/modules/swagger-codegen/src/main/resources/swift3/Models.mustache @@ -277,7 +277,10 @@ class Decoders { return Decoders.decode(clazz: {{classname}}.self, discriminator: discriminator, source: source) } {{/discriminator}} - + {{#additionalPropertiesType}} + var propsDictionary = sourceDictionary + let keys : [AnyHashable] = [{{#allVars}}{{^-last}}"{{baseName}}", {{/-last}}{{#-last}}"{{baseName}}"{{/-last}}{{/allVars}}] + {{/additionalPropertiesType}} {{#unwrapRequired}} {{#requiredVars}} guard let {{name}}Source = sourceDictionary["{{baseName}}"] as AnyObject? else { @@ -311,6 +314,18 @@ class Decoders { } {{/allVars}} {{/unwrapRequired}} + {{#additionalPropertiesType}} + + for key in keys { + propsDictionary.removeValue(forKey: key) + } + + for key in propsDictionary.keys { + if let decodedValue = Decoders.decodeOptional(clazz: String.self, source: propsDictionary[key] as AnyObject?) { + result[key] = decodedValue + } + } + {{/additionalPropertiesType}} return .success(result) } else { return .failure(.typeMismatch(expected: "{{classname}}", actual: "\(source)")) diff --git a/modules/swagger-codegen/src/main/resources/swift3/model.mustache b/modules/swagger-codegen/src/main/resources/swift3/model.mustache index 6184fb54dfa4..c1bd6ebdb872 100644 --- a/modules/swagger-codegen/src/main/resources/swift3/model.mustache +++ b/modules/swagger-codegen/src/main/resources/swift3/model.mustache @@ -27,6 +27,7 @@ public typealias {{classname}} = {{dataType}} {{/vars.isEmpty}} {{^vars.isEmpty}} open class {{classname}}: {{#parent}}{{{parent}}}{{/parent}}{{^parent}}JSONEncodable{{/parent}} { + {{#vars}} {{#isEnum}} public enum {{enumName}}: {{^isContainer}}{{datatype}}{{/isContainer}}{{#isContainer}}String{{/isContainer}} { {{#allowableValues}}{{#enumVars}} @@ -45,18 +46,32 @@ open class {{classname}}: {{#parent}}{{{parent}}}{{/parent}}{{^parent}}JSONEncod {{/isEnum}} {{/vars}} +{{#additionalPropertiesType}} + public var additionalProperties: [AnyHashable:{{{additionalPropertiesType}}}] = [:] + +{{/additionalPropertiesType}} {{^unwrapRequired}} - {{^parent}}public init() {}{{/parent}} -{{/unwrapRequired}} + {{^parent}}public init() {}{{/parent}}{{/unwrapRequired}} {{#unwrapRequired}} public init({{#allVars}}{{^-first}}, {{/-first}}{{name}}: {{#isEnum}}{{datatypeWithEnum}}{{/isEnum}}{{^isEnum}}{{datatype}}{{/isEnum}}{{^required}}?=nil{{/required}}{{/allVars}}) { {{#vars}} self.{{name}} = {{name}} {{/vars}} - {{#parent}}super.init({{#parentVars}}{{^-first}}, {{/-first}}{{name}}: {{name}}{{/parentVars}}){{/parent}} - } -{{/unwrapRequired}} + }{{/unwrapRequired}} +{{#additionalPropertiesType}} + public subscript(key: AnyHashable) -> {{{additionalPropertiesType}}}? { + get { + if let value = additionalProperties[key] { + return value + } + return nil + } + set { + additionalProperties[key] = newValue + } + } +{{/additionalPropertiesType}} // MARK: JSONEncodable {{#parent}}override {{/parent}}open func encodeToJSON() -> Any { var nillableDictionary = {{#parent}}super.encodeToJSON() as? [String:Any?] ?? {{/parent}}[String:Any?](){{#vars}}{{#isNotContainer}}{{#isPrimitiveType}}{{^isEnum}}{{#isInteger}} @@ -67,6 +82,15 @@ open class {{classname}}: {{#parent}}{{{parent}}}{{/parent}}{{^parent}}JSONEncod nillableDictionary["{{baseName}}"] = self.{{name}}{{^unwrapRequired}}?{{/unwrapRequired}}{{#unwrapRequired}}{{^required}}?{{/required}}{{/unwrapRequired}}.encodeToJSON(){{/isPrimitiveType}}{{/isNotContainer}}{{#isContainer}}{{^isEnum}} nillableDictionary["{{baseName}}"] = self.{{name}}{{^unwrapRequired}}?{{/unwrapRequired}}{{#unwrapRequired}}{{^required}}?{{/required}}{{/unwrapRequired}}.encodeToJSON(){{/isEnum}}{{#isEnum}}{{#isListContainer}} nillableDictionary["{{baseName}}"] = self.{{name}}{{^unwrapRequired}}?{{/unwrapRequired}}{{#unwrapRequired}}{{^required}}?{{/required}}{{/unwrapRequired}}.map({$0.rawValue}).encodeToJSON(){{/isListContainer}}{{#isMapContainer}}//TODO: handle enum map scenario{{/isMapContainer}}{{/isEnum}}{{/isContainer}}{{/vars}} + + {{#additionalPropertiesType}} + for (key, value) in additionalProperties { + if let key = key as? String { + nillableDictionary[key] = value + } + } + + {{/additionalPropertiesType}} let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/modules/swagger-codegen/src/main/resources/typescript-angular2/api.service.mustache b/modules/swagger-codegen/src/main/resources/typescript-angular2/api.service.mustache index 3b1c76b6a130..665c258e1982 100644 --- a/modules/swagger-codegen/src/main/resources/typescript-angular2/api.service.mustache +++ b/modules/swagger-codegen/src/main/resources/typescript-angular2/api.service.mustache @@ -247,9 +247,8 @@ export class {{classname}} { responseType: ResponseContentType.Blob, {{/isResponseFile}} search: queryParameters, - withCredentials:true + withCredentials:this.configuration.withCredentials }); - // https://github.com/swagger-api/swagger-codegen/issues/4037 if (extraHttpRequestParams) { requestOptions = (Object).assign(requestOptions, extraHttpRequestParams); diff --git a/modules/swagger-codegen/src/main/resources/typescript-angular2/configuration.mustache b/modules/swagger-codegen/src/main/resources/typescript-angular2/configuration.mustache index df90b4829bbb..0eed43fd575a 100644 --- a/modules/swagger-codegen/src/main/resources/typescript-angular2/configuration.mustache +++ b/modules/swagger-codegen/src/main/resources/typescript-angular2/configuration.mustache @@ -1,24 +1,26 @@ export interface ConfigurationParameters { - apiKeys?: {[ key: string ]: string}; - username?: string; - password?: string; - accessToken?: string; - basePath?: string; + apiKeys?: {[ key: string ]: string}; + username?: string; + password?: string; + accessToken?: string; + basePath?: string; + withCredentials?: boolean; } export class Configuration { - apiKeys: {[ key: string ]: string}; - username: string; - password: string; - accessToken: string | (() => string); - basePath: string; + apiKeys: {[ key: string ]: string}; + username: string; + password: string; + accessToken: string | (() => string); + basePath: string; + withCredentials: boolean; - - constructor(configurationParameters: ConfigurationParameters = {}) { - this.apiKeys = configurationParameters.apiKeys; - this.username = configurationParameters.username; - this.password = configurationParameters.password; - this.accessToken = configurationParameters.accessToken; - this.basePath = configurationParameters.basePath; - } + constructor(configurationParameters: ConfigurationParameters = {}) { + this.apiKeys = configurationParameters.apiKeys; + this.username = configurationParameters.username; + this.password = configurationParameters.password; + this.accessToken = configurationParameters.accessToken; + this.basePath = configurationParameters.basePath; + this.withCredentials = configurationParameters.withCredentials; + } } diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/Qt5CPPOptionsProvider.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/Qt5CPPOptionsProvider.java index 1ec213102977..82dec7ec3896 100644 --- a/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/Qt5CPPOptionsProvider.java +++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/Qt5CPPOptionsProvider.java @@ -3,6 +3,7 @@ package io.swagger.codegen.options; import io.swagger.codegen.CodegenConstants; import com.google.common.collect.ImmutableMap; +import io.swagger.codegen.languages.Qt5CPPGenerator; import java.util.Map; @@ -10,6 +11,7 @@ public class Qt5CPPOptionsProvider implements OptionsProvider { public static final String SORT_PARAMS_VALUE = "false"; public static final String ENSURE_UNIQUE_PARAMS_VALUE = "true"; public static final String ALLOW_UNICODE_IDENTIFIERS_VALUE = "false"; + public static final String CPP_NAMESPACE_VALUE = "Swagger"; @Override @@ -23,6 +25,7 @@ public class Qt5CPPOptionsProvider implements OptionsProvider { return builder.put(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG, SORT_PARAMS_VALUE) .put(CodegenConstants.ENSURE_UNIQUE_PARAMS, ENSURE_UNIQUE_PARAMS_VALUE) .put(CodegenConstants.ALLOW_UNICODE_IDENTIFIERS, ALLOW_UNICODE_IDENTIFIERS_VALUE) + .put(Qt5CPPGenerator.CPP_NAMESPACE, CPP_NAMESPACE_VALUE) .build(); } diff --git a/samples/client/petstore-security-test/python/petstore_api/apis/fake_api.py b/samples/client/petstore-security-test/python/petstore_api/apis/fake_api.py index 1c87f7d600fa..ff031d77b731 100644 --- a/samples/client/petstore-security-test/python/petstore_api/apis/fake_api.py +++ b/samples/client/petstore-security-test/python/petstore_api/apis/fake_api.py @@ -100,7 +100,7 @@ class FakeApi(object): path_params = {} - query_params = {} + query_params = [] header_params = {} diff --git a/samples/client/petstore-security-test/qt5cpp/client/SWGFakeApi.cpp b/samples/client/petstore-security-test/qt5cpp/client/SWGFakeApi.cpp index 698af00fdbdc..701dc946610f 100644 --- a/samples/client/petstore-security-test/qt5cpp/client/SWGFakeApi.cpp +++ b/samples/client/petstore-security-test/qt5cpp/client/SWGFakeApi.cpp @@ -18,6 +18,7 @@ #include namespace Swagger { + SWGFakeApi::SWGFakeApi() {} SWGFakeApi::~SWGFakeApi() {} @@ -69,4 +70,5 @@ SWGFakeApi::testCodeInject */ ' " =end \r\n \n \rCallback(HttpReq emit testCodeInject */ ' " =end \r\n \n \rSignal(); } -} /* namespace Swagger */ + +} diff --git a/samples/client/petstore-security-test/qt5cpp/client/SWGFakeApi.h b/samples/client/petstore-security-test/qt5cpp/client/SWGFakeApi.h index c2caf3615c66..e0200dd91f0e 100644 --- a/samples/client/petstore-security-test/qt5cpp/client/SWGFakeApi.h +++ b/samples/client/petstore-security-test/qt5cpp/client/SWGFakeApi.h @@ -41,5 +41,6 @@ signals: void testCodeInject */ ' " =end \r\n \n \rSignal(); }; + } #endif diff --git a/samples/client/petstore-security-test/qt5cpp/client/SWGHelpers.cpp b/samples/client/petstore-security-test/qt5cpp/client/SWGHelpers.cpp index baf3710b5d5a..25b79c2baf0d 100644 --- a/samples/client/petstore-security-test/qt5cpp/client/SWGHelpers.cpp +++ b/samples/client/petstore-security-test/qt5cpp/client/SWGHelpers.cpp @@ -18,6 +18,7 @@ #include #include + namespace Swagger { void @@ -130,7 +131,7 @@ setValue(void* value, QJsonValue obj, QString type, QString complexType) { else if(type.startsWith("SWG") && obj.isObject()) { // complex type QJsonObject jsonObj = obj.toObject(); - SWGObject * so = (SWGObject*)Swagger::create(type); + SWGObject * so = (SWGObject*)::Swagger::create(type); if(so != nullptr) { so->fromJsonObject(jsonObj); SWGObject **val = static_cast(value); @@ -290,4 +291,5 @@ QString stringValue(bool value) { return QString(value ? "true" : "false"); } -} /* namespace Swagger */ + +} diff --git a/samples/client/petstore-security-test/qt5cpp/client/SWGHelpers.h b/samples/client/petstore-security-test/qt5cpp/client/SWGHelpers.h index 7c5366e2aa4d..1b9ad7667edc 100644 --- a/samples/client/petstore-security-test/qt5cpp/client/SWGHelpers.h +++ b/samples/client/petstore-security-test/qt5cpp/client/SWGHelpers.h @@ -16,6 +16,7 @@ #include namespace Swagger { + void setValue(void* value, QJsonValue obj, QString type, QString complexType); void toJsonArray(QList* value, QJsonArray* output, QString innerName, QString innerType); void toJsonValue(QString name, void* value, QJsonObject* output, QString type); @@ -24,6 +25,7 @@ namespace Swagger { QString stringValue(qint32 value); QString stringValue(qint64 value); QString stringValue(bool value); + } #endif // SWGHELPERS_H diff --git a/samples/client/petstore-security-test/qt5cpp/client/SWGHttpRequest.cpp b/samples/client/petstore-security-test/qt5cpp/client/SWGHttpRequest.cpp index 30a52aef9fed..589921db7982 100644 --- a/samples/client/petstore-security-test/qt5cpp/client/SWGHttpRequest.cpp +++ b/samples/client/petstore-security-test/qt5cpp/client/SWGHttpRequest.cpp @@ -17,6 +17,8 @@ #include +namespace Swagger { + HttpRequestInput::HttpRequestInput() { initialize(); } @@ -309,3 +311,5 @@ void HttpRequestWorker::on_manager_finished(QNetworkReply *reply) { emit on_execution_finished(this); } + +} diff --git a/samples/client/petstore-security-test/qt5cpp/client/SWGHttpRequest.h b/samples/client/petstore-security-test/qt5cpp/client/SWGHttpRequest.h index 7136eef1d879..045bcd9c0752 100644 --- a/samples/client/petstore-security-test/qt5cpp/client/SWGHttpRequest.h +++ b/samples/client/petstore-security-test/qt5cpp/client/SWGHttpRequest.h @@ -27,6 +27,7 @@ enum HttpRequestVarLayout {NOT_SET, ADDRESS, URL_ENCODED, MULTIPART}; +namespace Swagger { class SWGHttpRequestInputFileElement { @@ -84,4 +85,6 @@ private slots: }; +} + #endif // HTTPREQUESTWORKER_H diff --git a/samples/client/petstore-security-test/qt5cpp/client/SWGModelFactory.h b/samples/client/petstore-security-test/qt5cpp/client/SWGModelFactory.h index 018edcc807b8..ca8499aa18f1 100644 --- a/samples/client/petstore-security-test/qt5cpp/client/SWGModelFactory.h +++ b/samples/client/petstore-security-test/qt5cpp/client/SWGModelFactory.h @@ -17,6 +17,7 @@ #include "SWGReturn.h" namespace Swagger { + inline void* create(QString type) { if(QString("SWGReturn").compare(type) == 0) { return new SWGReturn(); @@ -36,6 +37,7 @@ namespace Swagger { } return nullptr; } -} /* namespace Swagger */ + +} #endif /* ModelFactory_H_ */ diff --git a/samples/client/petstore-security-test/qt5cpp/client/SWGObject.h b/samples/client/petstore-security-test/qt5cpp/client/SWGObject.h index ed3c12dea923..6e5dbd311af9 100644 --- a/samples/client/petstore-security-test/qt5cpp/client/SWGObject.h +++ b/samples/client/petstore-security-test/qt5cpp/client/SWGObject.h @@ -15,6 +15,8 @@ #include +namespace Swagger { + class SWGObject { public: virtual QJsonObject* asJsonObject() { @@ -33,4 +35,6 @@ class SWGObject { } }; +} + #endif /* _SWG_OBJECT_H_ */ diff --git a/samples/client/petstore-security-test/qt5cpp/client/SWGReturn.cpp b/samples/client/petstore-security-test/qt5cpp/client/SWGReturn.cpp index 8f3b4dea221c..fc4cd89e5aa2 100644 --- a/samples/client/petstore-security-test/qt5cpp/client/SWGReturn.cpp +++ b/samples/client/petstore-security-test/qt5cpp/client/SWGReturn.cpp @@ -22,7 +22,6 @@ namespace Swagger { - SWGReturn::SWGReturn(QString* json) { init(); this->fromJson(*json); @@ -89,6 +88,5 @@ SWGReturn::setReturn(qint32 return) { } - -} /* namespace Swagger */ +} diff --git a/samples/client/petstore-security-test/qt5cpp/client/SWGReturn.h b/samples/client/petstore-security-test/qt5cpp/client/SWGReturn.h index 1f7f6a7b9e75..778899dbe3a0 100644 --- a/samples/client/petstore-security-test/qt5cpp/client/SWGReturn.h +++ b/samples/client/petstore-security-test/qt5cpp/client/SWGReturn.h @@ -49,6 +49,6 @@ private: qint32 return; }; -} /* namespace Swagger */ +} #endif /* SWGReturn_H_ */ diff --git a/samples/client/petstore/java/jersey2/hello.txt b/samples/client/petstore/java/jersey2/hello.txt deleted file mode 100644 index 6769dd60bdf5..000000000000 --- a/samples/client/petstore/java/jersey2/hello.txt +++ /dev/null @@ -1 +0,0 @@ -Hello world! \ No newline at end of file diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/build.gradle b/samples/client/petstore/java/okhttp-gson-parcelableModel/build.gradle index 923be3e4bbb5..a6c98c0f9317 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/build.gradle +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/build.gradle @@ -9,8 +9,8 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:1.5.+' - classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3' + classpath 'com.android.tools.build:gradle:2.3.+' + classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5' } } @@ -25,11 +25,11 @@ if(hasProperty('target') && target == 'android') { apply plugin: 'com.github.dcendents.android-maven' android { - compileSdkVersion 23 - buildToolsVersion '23.0.2' + compileSdkVersion 25 + buildToolsVersion '25.0.2' defaultConfig { minSdkVersion 14 - targetSdkVersion 23 + targetSdkVersion 25 } compileOptions { sourceCompatibility JavaVersion.VERSION_1_7 diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/EnumTest.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/EnumTest.java index b323d9d6913d..cb7fc84f13be 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/EnumTest.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/EnumTest.java @@ -245,7 +245,7 @@ public class EnumTest implements Parcelable { enumString = (EnumStringEnum)in.readValue(null); enumInteger = (EnumIntegerEnum)in.readValue(null); enumNumber = (EnumNumberEnum)in.readValue(null); - outerEnum = (OuterEnum)in.readValue(null); + outerEnum = (OuterEnum)in.readValue(OuterEnum.class.getClassLoader()); } public int describeContents() { diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/FormatTest.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/FormatTest.java index 56d0da58b72a..fb92f06cfe36 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/FormatTest.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/FormatTest.java @@ -414,15 +414,21 @@ public class FormatTest implements Parcelable { integer = (Integer)in.readValue(null); int32 = (Integer)in.readValue(null); int64 = (Long)in.readValue(null); - number = (BigDecimal)in.readValue(null); + number = (BigDecimal)in.readValue(BigDecimal.class.getClassLoader()); _float = (Float)in.readValue(null); _double = (Double)in.readValue(null); string = (String)in.readValue(null); _byte = (byte[])in.readValue(null); binary = (byte[])in.readValue(null); +<<<<<<< HEAD date = (LocalDate)in.readValue(null); dateTime = (OffsetDateTime)in.readValue(null); uuid = (UUID)in.readValue(null); +======= + date = (LocalDate)in.readValue(LocalDate.class.getClassLoader()); + dateTime = (DateTime)in.readValue(DateTime.class.getClassLoader()); + uuid = (UUID)in.readValue(UUID.class.getClassLoader()); +>>>>>>> origin/master password = (String)in.readValue(null); } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index 83a091139157..8a8a15735aaf 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -161,8 +161,13 @@ public class MixedPropertiesAndAdditionalPropertiesClass implements Parcelable { MixedPropertiesAndAdditionalPropertiesClass(Parcel in) { +<<<<<<< HEAD uuid = (UUID)in.readValue(null); dateTime = (OffsetDateTime)in.readValue(null); +======= + uuid = (UUID)in.readValue(UUID.class.getClassLoader()); + dateTime = (DateTime)in.readValue(DateTime.class.getClassLoader()); +>>>>>>> origin/master map = (Map)in.readValue(Animal.class.getClassLoader()); } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/NumberOnly.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/NumberOnly.java index 9e3d066ffd3f..fc5080b03386 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/NumberOnly.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/NumberOnly.java @@ -98,7 +98,7 @@ public class NumberOnly implements Parcelable { NumberOnly(Parcel in) { - justNumber = (BigDecimal)in.readValue(null); + justNumber = (BigDecimal)in.readValue(BigDecimal.class.getClassLoader()); } public int describeContents() { diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/Order.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/Order.java index ec559361e6be..e323c3b821dc 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/Order.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/Order.java @@ -251,7 +251,11 @@ public class Order implements Parcelable { id = (Long)in.readValue(null); petId = (Long)in.readValue(null); quantity = (Integer)in.readValue(null); +<<<<<<< HEAD shipDate = (OffsetDateTime)in.readValue(null); +======= + shipDate = (DateTime)in.readValue(DateTime.class.getClassLoader()); +>>>>>>> origin/master status = (StatusEnum)in.readValue(null); complete = (Boolean)in.readValue(null); } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/Pet.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/Pet.java index 85184e4d8845..a22f2fd0b7f5 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/Pet.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/Pet.java @@ -265,7 +265,7 @@ public class Pet implements Parcelable { Pet(Parcel in) { id = (Long)in.readValue(null); - category = (Category)in.readValue(null); + category = (Category)in.readValue(Category.class.getClassLoader()); name = (String)in.readValue(null); photoUrls = (List)in.readValue(null); tags = (List)in.readValue(Tag.class.getClassLoader()); diff --git a/samples/client/petstore/java/resteasy/build.gradle b/samples/client/petstore/java/resteasy/build.gradle index 05fdec0d7199..05970eaa2d84 100644 --- a/samples/client/petstore/java/resteasy/build.gradle +++ b/samples/client/petstore/java/resteasy/build.gradle @@ -1,115 +1,115 @@ -apply plugin: 'idea' -apply plugin: 'eclipse' - -group = 'io.swagger' -version = '1.0.0' - -buildscript { - repositories { - jcenter() - } - dependencies { - classpath 'com.android.tools.build:gradle:1.5.+' - classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3' - } -} - -repositories { - jcenter() -} - - -if(hasProperty('target') && target == 'android') { - - apply plugin: 'com.android.library' - apply plugin: 'com.github.dcendents.android-maven' - - android { - compileSdkVersion 23 - buildToolsVersion '23.0.2' - defaultConfig { - minSdkVersion 14 - targetSdkVersion 23 - } - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_7 - targetCompatibility JavaVersion.VERSION_1_7 - } - - // Rename the aar correctly - libraryVariants.all { variant -> - variant.outputs.each { output -> - def outputFile = output.outputFile - if (outputFile != null && outputFile.name.endsWith('.aar')) { - def fileName = "${project.name}-${variant.baseName}-${version}.aar" - output.outputFile = new File(outputFile.parent, fileName) - } - } - } - - dependencies { - provided 'javax.annotation:jsr250-api:1.0' - } - } - - afterEvaluate { - android.libraryVariants.all { variant -> - def task = project.tasks.create "jar${variant.name.capitalize()}", Jar - task.description = "Create jar artifact for ${variant.name}" - task.dependsOn variant.javaCompile - task.from variant.javaCompile.destinationDir - task.destinationDir = project.file("${project.buildDir}/outputs/jar") - task.archiveName = "${project.name}-${variant.baseName}-${version}.jar" - artifacts.add('archives', task); - } - } - - task sourcesJar(type: Jar) { - from android.sourceSets.main.java.srcDirs - classifier = 'sources' - } - - artifacts { - archives sourcesJar - } - -} else { - - apply plugin: 'java' - apply plugin: 'maven' - sourceCompatibility = JavaVersion.VERSION_1_7 - targetCompatibility = JavaVersion.VERSION_1_7 - - install { - repositories.mavenInstaller { - pom.artifactId = 'swagger-petstore-resteasy' - } - } - - task execute(type:JavaExec) { - main = System.getProperty('mainClass') - classpath = sourceSets.main.runtimeClasspath - } -} - -ext { - swagger_annotations_version = "1.5.8" - jackson_version = "2.7.5" - jersey_version = "2.22.2" - jodatime_version = "2.9.4" - junit_version = "4.12" -} - -dependencies { - compile "io.swagger:swagger-annotations:$swagger_annotations_version" - compile "org.glassfish.jersey.core:jersey-client:$jersey_version" - compile "org.glassfish.jersey.media:jersey-media-multipart:$jersey_version" - compile "org.glassfish.jersey.media:jersey-media-json-jackson:$jersey_version" - compile "com.fasterxml.jackson.core:jackson-core:$jackson_version" - compile "com.fasterxml.jackson.core:jackson-annotations:$jackson_version" - compile "com.fasterxml.jackson.core:jackson-databind:$jackson_version" - compile "com.fasterxml.jackson.datatype:jackson-datatype-joda:$jackson_version" - compile "joda-time:joda-time:$jodatime_version" - compile "com.brsanthu:migbase64:2.2" - testCompile "junit:junit:$junit_version" -} +apply plugin: 'idea' +apply plugin: 'eclipse' + +group = 'io.swagger' +version = '1.0.0' + +buildscript { + repositories { + jcenter() + } + dependencies { + classpath 'com.android.tools.build:gradle:1.5.+' + classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3' + } +} + +repositories { + jcenter() +} + + +if(hasProperty('target') && target == 'android') { + + apply plugin: 'com.android.library' + apply plugin: 'com.github.dcendents.android-maven' + + android { + compileSdkVersion 23 + buildToolsVersion '23.0.2' + defaultConfig { + minSdkVersion 14 + targetSdkVersion 23 + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_7 + targetCompatibility JavaVersion.VERSION_1_7 + } + + // Rename the aar correctly + libraryVariants.all { variant -> + variant.outputs.each { output -> + def outputFile = output.outputFile + if (outputFile != null && outputFile.name.endsWith('.aar')) { + def fileName = "${project.name}-${variant.baseName}-${version}.aar" + output.outputFile = new File(outputFile.parent, fileName) + } + } + } + + dependencies { + provided 'javax.annotation:jsr250-api:1.0' + } + } + + afterEvaluate { + android.libraryVariants.all { variant -> + def task = project.tasks.create "jar${variant.name.capitalize()}", Jar + task.description = "Create jar artifact for ${variant.name}" + task.dependsOn variant.javaCompile + task.from variant.javaCompile.destinationDir + task.destinationDir = project.file("${project.buildDir}/outputs/jar") + task.archiveName = "${project.name}-${variant.baseName}-${version}.jar" + artifacts.add('archives', task); + } + } + + task sourcesJar(type: Jar) { + from android.sourceSets.main.java.srcDirs + classifier = 'sources' + } + + artifacts { + archives sourcesJar + } + +} else { + + apply plugin: 'java' + apply plugin: 'maven' + sourceCompatibility = JavaVersion.VERSION_1_7 + targetCompatibility = JavaVersion.VERSION_1_7 + + install { + repositories.mavenInstaller { + pom.artifactId = 'swagger-petstore-resteasy' + } + } + + task execute(type:JavaExec) { + main = System.getProperty('mainClass') + classpath = sourceSets.main.runtimeClasspath + } +} + +ext { + swagger_annotations_version = "1.5.8" + jackson_version = "2.7.5" + jersey_version = "2.22.2" + jodatime_version = "2.9.4" + junit_version = "4.12" +} + +dependencies { + compile "io.swagger:swagger-annotations:$swagger_annotations_version" + compile "org.glassfish.jersey.core:jersey-client:$jersey_version" + compile "org.glassfish.jersey.media:jersey-media-multipart:$jersey_version" + compile "org.glassfish.jersey.media:jersey-media-json-jackson:$jersey_version" + compile "com.fasterxml.jackson.core:jackson-core:$jackson_version" + compile "com.fasterxml.jackson.core:jackson-annotations:$jackson_version" + compile "com.fasterxml.jackson.core:jackson-databind:$jackson_version" + compile "com.fasterxml.jackson.datatype:jackson-datatype-joda:$jackson_version" + compile "joda-time:joda-time:$jodatime_version" + compile "com.brsanthu:migbase64:2.2" + testCompile "junit:junit:$junit_version" +} diff --git a/samples/client/petstore/java/resteasy/build.sbt b/samples/client/petstore/java/resteasy/build.sbt index cf812e2335aa..7ef8075935fb 100644 --- a/samples/client/petstore/java/resteasy/build.sbt +++ b/samples/client/petstore/java/resteasy/build.sbt @@ -1,25 +1,25 @@ -lazy val root = (project in file(".")). - settings( - organization := "io.swagger", - name := "swagger-petstore-resteasy", - version := "1.0.0", - scalaVersion := "2.11.4", - scalacOptions ++= Seq("-feature"), - javacOptions in compile ++= Seq("-Xlint:deprecation"), - publishArtifact in (Compile, packageDoc) := false, - resolvers += Resolver.mavenLocal, - libraryDependencies ++= Seq( - "io.swagger" % "swagger-annotations" % "1.5.8", - "org.glassfish.jersey.core" % "jersey-client" % "2.22.2", - "org.glassfish.jersey.media" % "jersey-media-multipart" % "2.22.2", - "org.glassfish.jersey.media" % "jersey-media-json-jackson" % "2.22.2", - "com.fasterxml.jackson.core" % "jackson-core" % "2.7.5", - "com.fasterxml.jackson.core" % "jackson-annotations" % "2.7.5", - "com.fasterxml.jackson.core" % "jackson-databind" % "2.7.5", - "com.fasterxml.jackson.datatype" % "jackson-datatype-joda" % "2.7.5", - "joda-time" % "joda-time" % "2.9.4", - "com.brsanthu" % "migbase64" % "2.2", - "junit" % "junit" % "4.12" % "test", - "com.novocode" % "junit-interface" % "0.10" % "test" - ) - ) +lazy val root = (project in file(".")). + settings( + organization := "io.swagger", + name := "swagger-petstore-resteasy", + version := "1.0.0", + scalaVersion := "2.11.4", + scalacOptions ++= Seq("-feature"), + javacOptions in compile ++= Seq("-Xlint:deprecation"), + publishArtifact in (Compile, packageDoc) := false, + resolvers += Resolver.mavenLocal, + libraryDependencies ++= Seq( + "io.swagger" % "swagger-annotations" % "1.5.8", + "org.glassfish.jersey.core" % "jersey-client" % "2.22.2", + "org.glassfish.jersey.media" % "jersey-media-multipart" % "2.22.2", + "org.glassfish.jersey.media" % "jersey-media-json-jackson" % "2.22.2", + "com.fasterxml.jackson.core" % "jackson-core" % "2.7.5", + "com.fasterxml.jackson.core" % "jackson-annotations" % "2.7.5", + "com.fasterxml.jackson.core" % "jackson-databind" % "2.7.5", + "com.fasterxml.jackson.datatype" % "jackson-datatype-joda" % "2.7.5", + "joda-time" % "joda-time" % "2.9.4", + "com.brsanthu" % "migbase64" % "2.2", + "junit" % "junit" % "4.12" % "test", + "com.novocode" % "junit-interface" % "0.10" % "test" + ) + ) diff --git a/samples/client/petstore/java/resteasy/pom.xml b/samples/client/petstore/java/resteasy/pom.xml index f3db865f4b27..8421dc147988 100644 --- a/samples/client/petstore/java/resteasy/pom.xml +++ b/samples/client/petstore/java/resteasy/pom.xml @@ -1,185 +1,185 @@ - - 4.0.0 - io.swagger - swagger-petstore-resteasy - jar - swagger-petstore-resteasy - 1.0.0 - - scm:git:git@github.com:swagger-api/swagger-mustache.git - scm:git:git@github.com:swagger-api/swagger-codegen.git - https://github.com/swagger-api/swagger-codegen - - - 2.2.0 - - - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.12 - - - - loggerPath - conf/log4j.properties - - - -Xms512m -Xmx1500m - methods - pertest - - - - maven-dependency-plugin - - - package - - copy-dependencies - - - ${project.build.directory}/lib - - - - - - - - org.apache.maven.plugins - maven-jar-plugin - 2.6 - - - - jar - test-jar - - - - - - - - - org.codehaus.mojo - build-helper-maven-plugin - - - add_sources - generate-sources - - add-source - - - - src/main/java - - - - - add_test_sources - generate-test-sources - - add-test-source - - - - src/test/java - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 2.5.1 - - 1.7 - 1.7 - - - - org.apache.maven.plugins - maven-javadoc-plugin - 2.10.4 - - - - - - io.swagger - swagger-annotations - ${swagger-core-version} - - - - org.jboss.resteasy - resteasy-client - ${resteasy-version} - - - org.jboss.resteasy - resteasy-multipart-provider - ${resteasy-version} - - - - com.fasterxml.jackson.core - jackson-core - ${jackson-version} - - - com.fasterxml.jackson.core - jackson-annotations - ${jackson-version} - - - com.fasterxml.jackson.core - jackson-databind - ${jackson-version} - - - com.fasterxml.jackson.datatype - jackson-datatype-joda - ${jackson-version} - - - joda-time - joda-time - ${jodatime-version} - - - - - com.brsanthu - migbase64 - 2.2 - - - org.jboss.resteasy - resteasy-jackson-provider - 2.3.4.Final - - - - junit - junit - ${junit-version} - test - - - - 1.5.9 - 3.0.19.Final - 2.7.5 - 2.9.4 - 1.0.0 - 4.12 - - + + 4.0.0 + io.swagger + swagger-petstore-resteasy + jar + swagger-petstore-resteasy + 1.0.0 + + scm:git:git@github.com:swagger-api/swagger-mustache.git + scm:git:git@github.com:swagger-api/swagger-codegen.git + https://github.com/swagger-api/swagger-codegen + + + 2.2.0 + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.12 + + + + loggerPath + conf/log4j.properties + + + -Xms512m -Xmx1500m + methods + pertest + + + + maven-dependency-plugin + + + package + + copy-dependencies + + + ${project.build.directory}/lib + + + + + + + + org.apache.maven.plugins + maven-jar-plugin + 2.6 + + + + jar + test-jar + + + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + add_sources + generate-sources + + add-source + + + + src/main/java + + + + + add_test_sources + generate-test-sources + + add-test-source + + + + src/test/java + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 2.5.1 + + 1.7 + 1.7 + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.10.4 + + + + + + io.swagger + swagger-annotations + ${swagger-core-version} + + + + org.jboss.resteasy + resteasy-client + ${resteasy-version} + + + org.jboss.resteasy + resteasy-multipart-provider + ${resteasy-version} + + + + com.fasterxml.jackson.core + jackson-core + ${jackson-version} + + + com.fasterxml.jackson.core + jackson-annotations + ${jackson-version} + + + com.fasterxml.jackson.core + jackson-databind + ${jackson-version} + + + com.fasterxml.jackson.datatype + jackson-datatype-joda + ${jackson-version} + + + joda-time + joda-time + ${jodatime-version} + + + + + com.brsanthu + migbase64 + 2.2 + + + org.jboss.resteasy + resteasy-jackson-provider + 2.3.4.Final + + + + junit + junit + ${junit-version} + test + + + + 1.5.9 + 3.0.19.Final + 2.7.5 + 2.9.4 + 1.0.0 + 4.12 + + diff --git a/samples/client/petstore/java/resteasy/src/main/java/io/swagger/client/ApiClient.java b/samples/client/petstore/java/resteasy/src/main/java/io/swagger/client/ApiClient.java index 9d0a6d976ec1..84212e946216 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/io/swagger/client/ApiClient.java +++ b/samples/client/petstore/java/resteasy/src/main/java/io/swagger/client/ApiClient.java @@ -1,681 +1,681 @@ -package io.swagger.client; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.io.UnsupportedEncodingException; -import java.net.URLEncoder; -import java.nio.file.Files; -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.TimeZone; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import javax.ws.rs.client.Client; -import javax.ws.rs.client.ClientBuilder; -import javax.ws.rs.client.Entity; -import javax.ws.rs.client.Invocation; -import javax.ws.rs.client.WebTarget; -import javax.ws.rs.core.Form; -import javax.ws.rs.core.GenericType; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.Response.Status; - -import org.jboss.logging.Logger; -import org.jboss.resteasy.client.jaxrs.internal.ClientConfiguration; -import org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataOutput; -import org.jboss.resteasy.spi.ResteasyProviderFactory; - -import io.swagger.client.auth.Authentication; -import io.swagger.client.auth.HttpBasicAuth; -import io.swagger.client.auth.ApiKeyAuth; -import io.swagger.client.auth.OAuth; - - -public class ApiClient { - private Map defaultHeaderMap = new HashMap(); - private String basePath = "http://petstore.swagger.io:80/v2"; - private boolean debugging = false; - - private Client httpClient; - private JSON json; - private String tempFolderPath = null; - - private Map authentications; - - private int statusCode; - private Map> responseHeaders; - - private DateFormat dateFormat; - - public ApiClient() { - json = new JSON(); - httpClient = buildHttpClient(debugging); - - this.dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX"); - - // Use UTC as the default time zone. - this.dateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); - - this.json.setDateFormat((DateFormat) dateFormat.clone()); - - // Set default User-Agent. - setUserAgent("Swagger-Codegen/1.0.0/java"); - - // Setup authentications (key: authentication name, value: authentication). - authentications = new HashMap(); - authentications.put("api_key", new ApiKeyAuth("header", "api_key")); - authentications.put("http_basic_test", new HttpBasicAuth()); - authentications.put("petstore_auth", new OAuth()); - // Prevent the authentications from being modified. - authentications = Collections.unmodifiableMap(authentications); - } - - /** - * Gets the JSON instance to do JSON serialization and deserialization. - */ - public JSON getJSON() { - return json; - } - - public Client getHttpClient() { - return httpClient; - } - - public ApiClient setHttpClient(Client httpClient) { - this.httpClient = httpClient; - return this; - } - - public String getBasePath() { - return basePath; - } - - public ApiClient setBasePath(String basePath) { - this.basePath = basePath; - return this; - } - - /** - * Gets the status code of the previous request - */ - public int getStatusCode() { - return statusCode; - } - - /** - * Gets the response headers of the previous request - */ - public Map> getResponseHeaders() { - return responseHeaders; - } - - /** - * Get authentications (key: authentication name, value: authentication). - */ - public Map getAuthentications() { - return authentications; - } - - /** - * Get authentication for the given name. - * - * @param authName The authentication name - * @return The authentication, null if not found - */ - public Authentication getAuthentication(String authName) { - return authentications.get(authName); - } - - /** - * Helper method to set username for the first HTTP basic authentication. - */ - public void setUsername(String username) { - for (Authentication auth : authentications.values()) { - if (auth instanceof HttpBasicAuth) { - ((HttpBasicAuth) auth).setUsername(username); - return; - } - } - throw new RuntimeException("No HTTP basic authentication configured!"); - } - - /** - * Helper method to set password for the first HTTP basic authentication. - */ - public void setPassword(String password) { - for (Authentication auth : authentications.values()) { - if (auth instanceof HttpBasicAuth) { - ((HttpBasicAuth) auth).setPassword(password); - return; - } - } - throw new RuntimeException("No HTTP basic authentication configured!"); - } - - /** - * Helper method to set API key value for the first API key authentication. - */ - public void setApiKey(String apiKey) { - for (Authentication auth : authentications.values()) { - if (auth instanceof ApiKeyAuth) { - ((ApiKeyAuth) auth).setApiKey(apiKey); - return; - } - } - throw new RuntimeException("No API key authentication configured!"); - } - - /** - * Helper method to set API key prefix for the first API key authentication. - */ - public void setApiKeyPrefix(String apiKeyPrefix) { - for (Authentication auth : authentications.values()) { - if (auth instanceof ApiKeyAuth) { - ((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix); - return; - } - } - throw new RuntimeException("No API key authentication configured!"); - } - - /** - * Helper method to set access token for the first OAuth2 authentication. - */ - public void setAccessToken(String accessToken) { - for (Authentication auth : authentications.values()) { - if (auth instanceof OAuth) { - ((OAuth) auth).setAccessToken(accessToken); - return; - } - } - throw new RuntimeException("No OAuth2 authentication configured!"); - } - - /** - * Set the User-Agent header's value (by adding to the default header map). - */ - public ApiClient setUserAgent(String userAgent) { - addDefaultHeader("User-Agent", userAgent); - return this; - } - - /** - * Add a default header. - * - * @param key The header's key - * @param value The header's value - */ - public ApiClient addDefaultHeader(String key, String value) { - defaultHeaderMap.put(key, value); - return this; - } - - /** - * Check that whether debugging is enabled for this API client. - */ - public boolean isDebugging() { - return debugging; - } - - /** - * Enable/disable debugging for this API client. - * - * @param debugging To enable (true) or disable (false) debugging - */ - public ApiClient setDebugging(boolean debugging) { - this.debugging = debugging; - // Rebuild HTTP Client according to the new "debugging" value. - this.httpClient = buildHttpClient(debugging); - return this; - } - - /** - * The path of temporary folder used to store downloaded files from endpoints - * with file response. The default value is null, i.e. using - * the system's default tempopary folder. - * - * @see https://docs.oracle.com/javase/7/docs/api/java/io/File.html#createTempFile(java.lang.String,%20java.lang.String,%20java.io.File) - */ - public String getTempFolderPath() { - return tempFolderPath; - } - - public ApiClient setTempFolderPath(String tempFolderPath) { - this.tempFolderPath = tempFolderPath; - return this; - } - - /** - * Get the date format used to parse/format date parameters. - */ - public DateFormat getDateFormat() { - return dateFormat; - } - - /** - * Set the date format used to parse/format date parameters. - */ - public ApiClient setDateFormat(DateFormat dateFormat) { - this.dateFormat = dateFormat; - // also set the date format for model (de)serialization with Date properties - this.json.setDateFormat((DateFormat) dateFormat.clone()); - return this; - } - - /** - * Parse the given string into Date object. - */ - public Date parseDate(String str) { - try { - return dateFormat.parse(str); - } catch (java.text.ParseException e) { - throw new RuntimeException(e); - } - } - - /** - * Format the given Date object into string. - */ - public String formatDate(Date date) { - return dateFormat.format(date); - } - - /** - * Format the given parameter object into string. - */ - public String parameterToString(Object param) { - if (param == null) { - return ""; - } else if (param instanceof Date) { - return formatDate((Date) param); - } else if (param instanceof Collection) { - StringBuilder b = new StringBuilder(); - for(Object o : (Collection)param) { - if(b.length() > 0) { - b.append(","); - } - b.append(String.valueOf(o)); - } - return b.toString(); - } else { - return String.valueOf(param); - } - } - - /* - Format to {@code Pair} objects. - */ - public List parameterToPairs(String collectionFormat, String name, Object value){ - List params = new ArrayList(); - - // preconditions - if (name == null || name.isEmpty() || value == null) return params; - - Collection valueCollection = null; - if (value instanceof Collection) { - valueCollection = (Collection) value; - } else { - params.add(new Pair(name, parameterToString(value))); - return params; - } - - if (valueCollection.isEmpty()){ - return params; - } - - // get the collection format - collectionFormat = (collectionFormat == null || collectionFormat.isEmpty() ? "csv" : collectionFormat); // default: csv - - // create the params based on the collection format - if (collectionFormat.equals("multi")) { - for (Object item : valueCollection) { - params.add(new Pair(name, parameterToString(item))); - } - - return params; - } - - String delimiter = ","; - - if (collectionFormat.equals("csv")) { - delimiter = ","; - } else if (collectionFormat.equals("ssv")) { - delimiter = " "; - } else if (collectionFormat.equals("tsv")) { - delimiter = "\t"; - } else if (collectionFormat.equals("pipes")) { - delimiter = "|"; - } - - StringBuilder sb = new StringBuilder() ; - for (Object item : valueCollection) { - sb.append(delimiter); - sb.append(parameterToString(item)); - } - - params.add(new Pair(name, sb.substring(1))); - - return params; - } - - /** - * Check if the given MIME is a JSON MIME. - * JSON MIME examples: - * application/json - * application/json; charset=UTF8 - * APPLICATION/JSON - */ - public boolean isJsonMime(String mime) { - return mime != null && mime.matches("(?i)application\\/json(;.*)?"); - } - - /** - * Select the Accept header's value from the given accepts array: - * if JSON exists in the given array, use it; - * otherwise use all of them (joining into a string) - * - * @param accepts The accepts array to select from - * @return The Accept header to use. If the given array is empty, - * null will be returned (not to set the Accept header explicitly). - */ - public String selectHeaderAccept(String[] accepts) { - if (accepts.length == 0) { - return null; - } - for (String accept : accepts) { - if (isJsonMime(accept)) { - return accept; - } - } - return StringUtil.join(accepts, ","); - } - - /** - * Select the Content-Type header's value from the given array: - * if JSON exists in the given array, use it; - * otherwise use the first one of the array. - * - * @param contentTypes The Content-Type array to select from - * @return The Content-Type header to use. If the given array is empty, - * JSON will be used. - */ - public String selectHeaderContentType(String[] contentTypes) { - if (contentTypes.length == 0) { - return "application/json"; - } - for (String contentType : contentTypes) { - if (isJsonMime(contentType)) { - return contentType; - } - } - return contentTypes[0]; - } - - /** - * Escape the given string to be used as URL query value. - */ - public String escapeString(String str) { - try { - return URLEncoder.encode(str, "utf8").replaceAll("\\+", "%20"); - } catch (UnsupportedEncodingException e) { - return str; - } - } - - /** - * Serialize the given Java object into string entity according the given - * Content-Type (only JSON is supported for now). - */ - public Entity serialize(Object obj, Map formParams, String contentType) throws ApiException { - Entity entity = null; - if (contentType.startsWith("multipart/form-data")) { - MultipartFormDataOutput multipart = new MultipartFormDataOutput(); - //MultiPart multiPart = new MultiPart(); - for (Entry param: formParams.entrySet()) { - if (param.getValue() instanceof File) { - File file = (File) param.getValue(); - try { - multipart.addFormData(param.getValue().toString(),new FileInputStream(file),MediaType.APPLICATION_OCTET_STREAM_TYPE); - } catch (FileNotFoundException e) { - throw new ApiException("Could not serialize multipart/form-data "+e.getMessage()); - } - } else { - multipart.addFormData(param.getValue().toString(),param.getValue().toString(),MediaType.APPLICATION_OCTET_STREAM_TYPE); - } - } - entity = Entity.entity(multipart.getFormData(), MediaType.MULTIPART_FORM_DATA_TYPE); - } else if (contentType.startsWith("application/x-www-form-urlencoded")) { - Form form = new Form(); - for (Entry param: formParams.entrySet()) { - form.param(param.getKey(), parameterToString(param.getValue())); - } - entity = Entity.entity(form, MediaType.APPLICATION_FORM_URLENCODED_TYPE); - } else { - // We let jersey handle the serialization - entity = Entity.entity(obj, contentType); - } - return entity; - } - - /** - * Deserialize response body to Java object according to the Content-Type. - */ - public T deserialize(Response response, GenericType returnType) throws ApiException { - if (response == null || returnType == null) { - return null; - } - - if ("byte[]".equals(returnType.toString())) { - // Handle binary response (byte array). - return (T) response.readEntity(byte[].class); - } else if (returnType.equals(File.class)) { - // Handle file downloading. - @SuppressWarnings("unchecked") - T file = (T) downloadFileFromResponse(response); - return file; - } - - String contentType = null; - List contentTypes = response.getHeaders().get("Content-Type"); - if (contentTypes != null && !contentTypes.isEmpty()) - contentType = String.valueOf(contentTypes.get(0)); - if (contentType == null) - throw new ApiException(500, "missing Content-Type in response"); - - return response.readEntity(returnType); - } - - /** - * Download file from the given response. - * @throws ApiException If fail to read file content from response and write to disk - */ - public File downloadFileFromResponse(Response response) throws ApiException { - try { - File file = prepareDownloadFile(response); - Files.copy(response.readEntity(InputStream.class), file.toPath()); - return file; - } catch (IOException e) { - throw new ApiException(e); - } - } - - public File prepareDownloadFile(Response response) throws IOException { - String filename = null; - String contentDisposition = (String) response.getHeaders().getFirst("Content-Disposition"); - if (contentDisposition != null && !"".equals(contentDisposition)) { - // Get filename from the Content-Disposition header. - Pattern pattern = Pattern.compile("filename=['\"]?([^'\"\\s]+)['\"]?"); - Matcher matcher = pattern.matcher(contentDisposition); - if (matcher.find()) - filename = matcher.group(1); - } - - String prefix = null; - String suffix = null; - if (filename == null) { - prefix = "download-"; - suffix = ""; - } else { - int pos = filename.lastIndexOf("."); - if (pos == -1) { - prefix = filename + "-"; - } else { - prefix = filename.substring(0, pos) + "-"; - suffix = filename.substring(pos); - } - // File.createTempFile requires the prefix to be at least three characters long - if (prefix.length() < 3) - prefix = "download-"; - } - - if (tempFolderPath == null) - return File.createTempFile(prefix, suffix); - else - return File.createTempFile(prefix, suffix, new File(tempFolderPath)); - } - - /** - * Invoke API by sending HTTP request with the given options. - * - * @param path The sub-path of the HTTP URL - * @param method The request method, one of "GET", "POST", "PUT", and "DELETE" - * @param queryParams The query parameters - * @param body The request body object - * @param headerParams The header parameters - * @param formParams The form parameters - * @param accept The request's Accept header - * @param contentType The request's Content-Type header - * @param authNames The authentications to apply - * @param returnType The return type into which to deserialize the response - * @return The response body in type of string - */ - public T invokeAPI(String path, String method, List queryParams, Object body, Map headerParams, Map formParams, String accept, String contentType, String[] authNames, GenericType returnType) throws ApiException { - updateParamsForAuth(authNames, queryParams, headerParams); - - // Not using `.target(this.basePath).path(path)` below, - // to support (constant) query string in `path`, e.g. "/posts?draft=1" - WebTarget target = httpClient.target(this.basePath + path); - - if (queryParams != null) { - for (Pair queryParam : queryParams) { - if (queryParam.getValue() != null) { - target = target.queryParam(queryParam.getName(), queryParam.getValue()); - } - } - } - - Invocation.Builder invocationBuilder = target.request().accept(accept); - - for (String key : headerParams.keySet()) { - String value = headerParams.get(key); - if (value != null) { - invocationBuilder = invocationBuilder.header(key, value); - } - } - - for (String key : defaultHeaderMap.keySet()) { - if (!headerParams.containsKey(key)) { - String value = defaultHeaderMap.get(key); - if (value != null) { - invocationBuilder = invocationBuilder.header(key, value); - } - } - } - - Entity entity = serialize(body, formParams, contentType); - - Response response = null; - - if ("GET".equals(method)) { - response = invocationBuilder.get(); - } else if ("POST".equals(method)) { - response = invocationBuilder.post(entity); - } else if ("PUT".equals(method)) { - response = invocationBuilder.put(entity); - } else if ("DELETE".equals(method)) { - response = invocationBuilder.delete(); - } else if ("PATCH".equals(method)) { - response = invocationBuilder.header("X-HTTP-Method-Override", "PATCH").post(entity); - } else { - throw new ApiException(500, "unknown method type " + method); - } - - statusCode = response.getStatusInfo().getStatusCode(); - responseHeaders = buildResponseHeaders(response); - - if (response.getStatus() == Status.NO_CONTENT.getStatusCode()) { - return null; - } else if (response.getStatusInfo().getFamily().equals(Status.Family.SUCCESSFUL)) { - if (returnType == null) - return null; - else - return deserialize(response, returnType); - } else { - String message = "error"; - String respBody = null; - if (response.hasEntity()) { - try { - respBody = String.valueOf(response.readEntity(String.class)); - message = respBody; - } catch (RuntimeException e) { - // e.printStackTrace(); - } - } - throw new ApiException( - response.getStatus(), - message, - buildResponseHeaders(response), - respBody); - } - } - - /** - * Build the Client used to make HTTP requests. - */ - private Client buildHttpClient(boolean debugging) { - final ClientConfiguration clientConfig = new ClientConfiguration(ResteasyProviderFactory.getInstance()); - clientConfig.register(json); - if(debugging){ - clientConfig.register(Logger.class); - } - return ClientBuilder.newClient(clientConfig); - } - private Map> buildResponseHeaders(Response response) { - Map> responseHeaders = new HashMap>(); - for (Entry> entry: response.getHeaders().entrySet()) { - List values = entry.getValue(); - List headers = new ArrayList(); - for (Object o : values) { - headers.add(String.valueOf(o)); - } - responseHeaders.put(entry.getKey(), headers); - } - return responseHeaders; - } - - /** - * Update query and header parameters based on authentication settings. - * - * @param authNames The authentications to apply - */ - private void updateParamsForAuth(String[] authNames, List queryParams, Map headerParams) { - for (String authName : authNames) { - Authentication auth = authentications.get(authName); - if (auth == null) throw new RuntimeException("Authentication undefined: " + authName); - auth.applyToParams(queryParams, headerParams); - } - } -} +package io.swagger.client; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.file.Files; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.TimeZone; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import javax.ws.rs.client.Client; +import javax.ws.rs.client.ClientBuilder; +import javax.ws.rs.client.Entity; +import javax.ws.rs.client.Invocation; +import javax.ws.rs.client.WebTarget; +import javax.ws.rs.core.Form; +import javax.ws.rs.core.GenericType; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.Response.Status; + +import org.jboss.logging.Logger; +import org.jboss.resteasy.client.jaxrs.internal.ClientConfiguration; +import org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataOutput; +import org.jboss.resteasy.spi.ResteasyProviderFactory; + +import io.swagger.client.auth.Authentication; +import io.swagger.client.auth.HttpBasicAuth; +import io.swagger.client.auth.ApiKeyAuth; +import io.swagger.client.auth.OAuth; + + +public class ApiClient { + private Map defaultHeaderMap = new HashMap(); + private String basePath = "http://petstore.swagger.io:80/v2"; + private boolean debugging = false; + + private Client httpClient; + private JSON json; + private String tempFolderPath = null; + + private Map authentications; + + private int statusCode; + private Map> responseHeaders; + + private DateFormat dateFormat; + + public ApiClient() { + json = new JSON(); + httpClient = buildHttpClient(debugging); + + this.dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX"); + + // Use UTC as the default time zone. + this.dateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); + + this.json.setDateFormat((DateFormat) dateFormat.clone()); + + // Set default User-Agent. + setUserAgent("Swagger-Codegen/1.0.0/java"); + + // Setup authentications (key: authentication name, value: authentication). + authentications = new HashMap(); + authentications.put("api_key", new ApiKeyAuth("header", "api_key")); + authentications.put("http_basic_test", new HttpBasicAuth()); + authentications.put("petstore_auth", new OAuth()); + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + /** + * Gets the JSON instance to do JSON serialization and deserialization. + */ + public JSON getJSON() { + return json; + } + + public Client getHttpClient() { + return httpClient; + } + + public ApiClient setHttpClient(Client httpClient) { + this.httpClient = httpClient; + return this; + } + + public String getBasePath() { + return basePath; + } + + public ApiClient setBasePath(String basePath) { + this.basePath = basePath; + return this; + } + + /** + * Gets the status code of the previous request + */ + public int getStatusCode() { + return statusCode; + } + + /** + * Gets the response headers of the previous request + */ + public Map> getResponseHeaders() { + return responseHeaders; + } + + /** + * Get authentications (key: authentication name, value: authentication). + */ + public Map getAuthentications() { + return authentications; + } + + /** + * Get authentication for the given name. + * + * @param authName The authentication name + * @return The authentication, null if not found + */ + public Authentication getAuthentication(String authName) { + return authentications.get(authName); + } + + /** + * Helper method to set username for the first HTTP basic authentication. + */ + public void setUsername(String username) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setUsername(username); + return; + } + } + throw new RuntimeException("No HTTP basic authentication configured!"); + } + + /** + * Helper method to set password for the first HTTP basic authentication. + */ + public void setPassword(String password) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setPassword(password); + return; + } + } + throw new RuntimeException("No HTTP basic authentication configured!"); + } + + /** + * Helper method to set API key value for the first API key authentication. + */ + public void setApiKey(String apiKey) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKey(apiKey); + return; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set API key prefix for the first API key authentication. + */ + public void setApiKeyPrefix(String apiKeyPrefix) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix); + return; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set access token for the first OAuth2 authentication. + */ + public void setAccessToken(String accessToken) { + for (Authentication auth : authentications.values()) { + if (auth instanceof OAuth) { + ((OAuth) auth).setAccessToken(accessToken); + return; + } + } + throw new RuntimeException("No OAuth2 authentication configured!"); + } + + /** + * Set the User-Agent header's value (by adding to the default header map). + */ + public ApiClient setUserAgent(String userAgent) { + addDefaultHeader("User-Agent", userAgent); + return this; + } + + /** + * Add a default header. + * + * @param key The header's key + * @param value The header's value + */ + public ApiClient addDefaultHeader(String key, String value) { + defaultHeaderMap.put(key, value); + return this; + } + + /** + * Check that whether debugging is enabled for this API client. + */ + public boolean isDebugging() { + return debugging; + } + + /** + * Enable/disable debugging for this API client. + * + * @param debugging To enable (true) or disable (false) debugging + */ + public ApiClient setDebugging(boolean debugging) { + this.debugging = debugging; + // Rebuild HTTP Client according to the new "debugging" value. + this.httpClient = buildHttpClient(debugging); + return this; + } + + /** + * The path of temporary folder used to store downloaded files from endpoints + * with file response. The default value is null, i.e. using + * the system's default tempopary folder. + * + * @see https://docs.oracle.com/javase/7/docs/api/java/io/File.html#createTempFile(java.lang.String,%20java.lang.String,%20java.io.File) + */ + public String getTempFolderPath() { + return tempFolderPath; + } + + public ApiClient setTempFolderPath(String tempFolderPath) { + this.tempFolderPath = tempFolderPath; + return this; + } + + /** + * Get the date format used to parse/format date parameters. + */ + public DateFormat getDateFormat() { + return dateFormat; + } + + /** + * Set the date format used to parse/format date parameters. + */ + public ApiClient setDateFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; + // also set the date format for model (de)serialization with Date properties + this.json.setDateFormat((DateFormat) dateFormat.clone()); + return this; + } + + /** + * Parse the given string into Date object. + */ + public Date parseDate(String str) { + try { + return dateFormat.parse(str); + } catch (java.text.ParseException e) { + throw new RuntimeException(e); + } + } + + /** + * Format the given Date object into string. + */ + public String formatDate(Date date) { + return dateFormat.format(date); + } + + /** + * Format the given parameter object into string. + */ + public String parameterToString(Object param) { + if (param == null) { + return ""; + } else if (param instanceof Date) { + return formatDate((Date) param); + } else if (param instanceof Collection) { + StringBuilder b = new StringBuilder(); + for(Object o : (Collection)param) { + if(b.length() > 0) { + b.append(","); + } + b.append(String.valueOf(o)); + } + return b.toString(); + } else { + return String.valueOf(param); + } + } + + /* + Format to {@code Pair} objects. + */ + public List parameterToPairs(String collectionFormat, String name, Object value){ + List params = new ArrayList(); + + // preconditions + if (name == null || name.isEmpty() || value == null) return params; + + Collection valueCollection = null; + if (value instanceof Collection) { + valueCollection = (Collection) value; + } else { + params.add(new Pair(name, parameterToString(value))); + return params; + } + + if (valueCollection.isEmpty()){ + return params; + } + + // get the collection format + collectionFormat = (collectionFormat == null || collectionFormat.isEmpty() ? "csv" : collectionFormat); // default: csv + + // create the params based on the collection format + if (collectionFormat.equals("multi")) { + for (Object item : valueCollection) { + params.add(new Pair(name, parameterToString(item))); + } + + return params; + } + + String delimiter = ","; + + if (collectionFormat.equals("csv")) { + delimiter = ","; + } else if (collectionFormat.equals("ssv")) { + delimiter = " "; + } else if (collectionFormat.equals("tsv")) { + delimiter = "\t"; + } else if (collectionFormat.equals("pipes")) { + delimiter = "|"; + } + + StringBuilder sb = new StringBuilder() ; + for (Object item : valueCollection) { + sb.append(delimiter); + sb.append(parameterToString(item)); + } + + params.add(new Pair(name, sb.substring(1))); + + return params; + } + + /** + * Check if the given MIME is a JSON MIME. + * JSON MIME examples: + * application/json + * application/json; charset=UTF8 + * APPLICATION/JSON + */ + public boolean isJsonMime(String mime) { + return mime != null && mime.matches("(?i)application\\/json(;.*)?"); + } + + /** + * Select the Accept header's value from the given accepts array: + * if JSON exists in the given array, use it; + * otherwise use all of them (joining into a string) + * + * @param accepts The accepts array to select from + * @return The Accept header to use. If the given array is empty, + * null will be returned (not to set the Accept header explicitly). + */ + public String selectHeaderAccept(String[] accepts) { + if (accepts.length == 0) { + return null; + } + for (String accept : accepts) { + if (isJsonMime(accept)) { + return accept; + } + } + return StringUtil.join(accepts, ","); + } + + /** + * Select the Content-Type header's value from the given array: + * if JSON exists in the given array, use it; + * otherwise use the first one of the array. + * + * @param contentTypes The Content-Type array to select from + * @return The Content-Type header to use. If the given array is empty, + * JSON will be used. + */ + public String selectHeaderContentType(String[] contentTypes) { + if (contentTypes.length == 0) { + return "application/json"; + } + for (String contentType : contentTypes) { + if (isJsonMime(contentType)) { + return contentType; + } + } + return contentTypes[0]; + } + + /** + * Escape the given string to be used as URL query value. + */ + public String escapeString(String str) { + try { + return URLEncoder.encode(str, "utf8").replaceAll("\\+", "%20"); + } catch (UnsupportedEncodingException e) { + return str; + } + } + + /** + * Serialize the given Java object into string entity according the given + * Content-Type (only JSON is supported for now). + */ + public Entity serialize(Object obj, Map formParams, String contentType) throws ApiException { + Entity entity = null; + if (contentType.startsWith("multipart/form-data")) { + MultipartFormDataOutput multipart = new MultipartFormDataOutput(); + //MultiPart multiPart = new MultiPart(); + for (Entry param: formParams.entrySet()) { + if (param.getValue() instanceof File) { + File file = (File) param.getValue(); + try { + multipart.addFormData(param.getValue().toString(),new FileInputStream(file),MediaType.APPLICATION_OCTET_STREAM_TYPE); + } catch (FileNotFoundException e) { + throw new ApiException("Could not serialize multipart/form-data "+e.getMessage()); + } + } else { + multipart.addFormData(param.getValue().toString(),param.getValue().toString(),MediaType.APPLICATION_OCTET_STREAM_TYPE); + } + } + entity = Entity.entity(multipart.getFormData(), MediaType.MULTIPART_FORM_DATA_TYPE); + } else if (contentType.startsWith("application/x-www-form-urlencoded")) { + Form form = new Form(); + for (Entry param: formParams.entrySet()) { + form.param(param.getKey(), parameterToString(param.getValue())); + } + entity = Entity.entity(form, MediaType.APPLICATION_FORM_URLENCODED_TYPE); + } else { + // We let jersey handle the serialization + entity = Entity.entity(obj, contentType); + } + return entity; + } + + /** + * Deserialize response body to Java object according to the Content-Type. + */ + public T deserialize(Response response, GenericType returnType) throws ApiException { + if (response == null || returnType == null) { + return null; + } + + if ("byte[]".equals(returnType.toString())) { + // Handle binary response (byte array). + return (T) response.readEntity(byte[].class); + } else if (returnType.equals(File.class)) { + // Handle file downloading. + @SuppressWarnings("unchecked") + T file = (T) downloadFileFromResponse(response); + return file; + } + + String contentType = null; + List contentTypes = response.getHeaders().get("Content-Type"); + if (contentTypes != null && !contentTypes.isEmpty()) + contentType = String.valueOf(contentTypes.get(0)); + if (contentType == null) + throw new ApiException(500, "missing Content-Type in response"); + + return response.readEntity(returnType); + } + + /** + * Download file from the given response. + * @throws ApiException If fail to read file content from response and write to disk + */ + public File downloadFileFromResponse(Response response) throws ApiException { + try { + File file = prepareDownloadFile(response); + Files.copy(response.readEntity(InputStream.class), file.toPath()); + return file; + } catch (IOException e) { + throw new ApiException(e); + } + } + + public File prepareDownloadFile(Response response) throws IOException { + String filename = null; + String contentDisposition = (String) response.getHeaders().getFirst("Content-Disposition"); + if (contentDisposition != null && !"".equals(contentDisposition)) { + // Get filename from the Content-Disposition header. + Pattern pattern = Pattern.compile("filename=['\"]?([^'\"\\s]+)['\"]?"); + Matcher matcher = pattern.matcher(contentDisposition); + if (matcher.find()) + filename = matcher.group(1); + } + + String prefix = null; + String suffix = null; + if (filename == null) { + prefix = "download-"; + suffix = ""; + } else { + int pos = filename.lastIndexOf("."); + if (pos == -1) { + prefix = filename + "-"; + } else { + prefix = filename.substring(0, pos) + "-"; + suffix = filename.substring(pos); + } + // File.createTempFile requires the prefix to be at least three characters long + if (prefix.length() < 3) + prefix = "download-"; + } + + if (tempFolderPath == null) + return File.createTempFile(prefix, suffix); + else + return File.createTempFile(prefix, suffix, new File(tempFolderPath)); + } + + /** + * Invoke API by sending HTTP request with the given options. + * + * @param path The sub-path of the HTTP URL + * @param method The request method, one of "GET", "POST", "PUT", and "DELETE" + * @param queryParams The query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param formParams The form parameters + * @param accept The request's Accept header + * @param contentType The request's Content-Type header + * @param authNames The authentications to apply + * @param returnType The return type into which to deserialize the response + * @return The response body in type of string + */ + public T invokeAPI(String path, String method, List queryParams, Object body, Map headerParams, Map formParams, String accept, String contentType, String[] authNames, GenericType returnType) throws ApiException { + updateParamsForAuth(authNames, queryParams, headerParams); + + // Not using `.target(this.basePath).path(path)` below, + // to support (constant) query string in `path`, e.g. "/posts?draft=1" + WebTarget target = httpClient.target(this.basePath + path); + + if (queryParams != null) { + for (Pair queryParam : queryParams) { + if (queryParam.getValue() != null) { + target = target.queryParam(queryParam.getName(), queryParam.getValue()); + } + } + } + + Invocation.Builder invocationBuilder = target.request().accept(accept); + + for (String key : headerParams.keySet()) { + String value = headerParams.get(key); + if (value != null) { + invocationBuilder = invocationBuilder.header(key, value); + } + } + + for (String key : defaultHeaderMap.keySet()) { + if (!headerParams.containsKey(key)) { + String value = defaultHeaderMap.get(key); + if (value != null) { + invocationBuilder = invocationBuilder.header(key, value); + } + } + } + + Entity entity = serialize(body, formParams, contentType); + + Response response = null; + + if ("GET".equals(method)) { + response = invocationBuilder.get(); + } else if ("POST".equals(method)) { + response = invocationBuilder.post(entity); + } else if ("PUT".equals(method)) { + response = invocationBuilder.put(entity); + } else if ("DELETE".equals(method)) { + response = invocationBuilder.delete(); + } else if ("PATCH".equals(method)) { + response = invocationBuilder.header("X-HTTP-Method-Override", "PATCH").post(entity); + } else { + throw new ApiException(500, "unknown method type " + method); + } + + statusCode = response.getStatusInfo().getStatusCode(); + responseHeaders = buildResponseHeaders(response); + + if (response.getStatus() == Status.NO_CONTENT.getStatusCode()) { + return null; + } else if (response.getStatusInfo().getFamily().equals(Status.Family.SUCCESSFUL)) { + if (returnType == null) + return null; + else + return deserialize(response, returnType); + } else { + String message = "error"; + String respBody = null; + if (response.hasEntity()) { + try { + respBody = String.valueOf(response.readEntity(String.class)); + message = respBody; + } catch (RuntimeException e) { + // e.printStackTrace(); + } + } + throw new ApiException( + response.getStatus(), + message, + buildResponseHeaders(response), + respBody); + } + } + + /** + * Build the Client used to make HTTP requests. + */ + private Client buildHttpClient(boolean debugging) { + final ClientConfiguration clientConfig = new ClientConfiguration(ResteasyProviderFactory.getInstance()); + clientConfig.register(json); + if(debugging){ + clientConfig.register(Logger.class); + } + return ClientBuilder.newClient(clientConfig); + } + private Map> buildResponseHeaders(Response response) { + Map> responseHeaders = new HashMap>(); + for (Entry> entry: response.getHeaders().entrySet()) { + List values = entry.getValue(); + List headers = new ArrayList(); + for (Object o : values) { + headers.add(String.valueOf(o)); + } + responseHeaders.put(entry.getKey(), headers); + } + return responseHeaders; + } + + /** + * Update query and header parameters based on authentication settings. + * + * @param authNames The authentications to apply + */ + private void updateParamsForAuth(String[] authNames, List queryParams, Map headerParams) { + for (String authName : authNames) { + Authentication auth = authentications.get(authName); + if (auth == null) throw new RuntimeException("Authentication undefined: " + authName); + auth.applyToParams(queryParams, headerParams); + } + } +} diff --git a/samples/client/petstore/java/resteasy/src/main/java/io/swagger/client/JSON.java b/samples/client/petstore/java/resteasy/src/main/java/io/swagger/client/JSON.java index f0c888dc41ec..126fa1c856ac 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/io/swagger/client/JSON.java +++ b/samples/client/petstore/java/resteasy/src/main/java/io/swagger/client/JSON.java @@ -1,37 +1,37 @@ -package io.swagger.client; - -import com.fasterxml.jackson.annotation.*; -import com.fasterxml.jackson.databind.*; -import com.fasterxml.jackson.datatype.joda.*; - -import java.text.DateFormat; - -import javax.ws.rs.ext.ContextResolver; - - -public class JSON implements ContextResolver { - private ObjectMapper mapper; - - public JSON() { - mapper = new ObjectMapper(); - mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); - mapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING); - mapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING); - mapper.setDateFormat(new RFC3339DateFormat()); - mapper.registerModule(new JodaModule()); - } - - /** - * Set the date format for JSON (de)serialization with Date properties. - */ - public void setDateFormat(DateFormat dateFormat) { - mapper.setDateFormat(dateFormat); - } - - @Override - public ObjectMapper getContext(Class type) { - return mapper; - } -} +package io.swagger.client; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.*; +import com.fasterxml.jackson.datatype.joda.*; + +import java.text.DateFormat; + +import javax.ws.rs.ext.ContextResolver; + + +public class JSON implements ContextResolver { + private ObjectMapper mapper; + + public JSON() { + mapper = new ObjectMapper(); + mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); + mapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING); + mapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING); + mapper.setDateFormat(new RFC3339DateFormat()); + mapper.registerModule(new JodaModule()); + } + + /** + * Set the date format for JSON (de)serialization with Date properties. + */ + public void setDateFormat(DateFormat dateFormat) { + mapper.setDateFormat(dateFormat); + } + + @Override + public ObjectMapper getContext(Class type) { + return mapper; + } +} diff --git a/samples/client/petstore/java/resteasy/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/resteasy/src/main/java/io/swagger/client/api/FakeApi.java index b833e3e53c47..1bc9d46a7b64 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/io/swagger/client/api/FakeApi.java +++ b/samples/client/petstore/java/resteasy/src/main/java/io/swagger/client/api/FakeApi.java @@ -1,232 +1,232 @@ -package io.swagger.client.api; - -import io.swagger.client.ApiException; -import io.swagger.client.ApiClient; -import io.swagger.client.Configuration; -import io.swagger.client.Pair; - -import javax.ws.rs.core.GenericType; - -import java.math.BigDecimal; -import io.swagger.client.model.Client; -import org.joda.time.DateTime; -import org.joda.time.LocalDate; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - - -public class FakeApi { - private ApiClient apiClient; - - public FakeApi() { - this(Configuration.getDefaultApiClient()); - } - - public FakeApi(ApiClient apiClient) { - this.apiClient = apiClient; - } - - public ApiClient getApiClient() { - return apiClient; - } - - public void setApiClient(ApiClient apiClient) { - this.apiClient = apiClient; - } - - /** - * To test \"client\" model - * To test \"client\" model - * @param body client model (required) - * @return Client - * @throws ApiException if fails to make API call - */ - public Client testClientModel(Client body) throws ApiException { - Object localVarPostBody = body; - - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling testClientModel"); - } - - // create path and map variables - String localVarPath = "/fake".replaceAll("\\{format\\}","json"); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "PATCH", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - * @param number None (required) - * @param _double None (required) - * @param patternWithoutDelimiter None (required) - * @param _byte None (required) - * @param integer None (optional) - * @param int32 None (optional) - * @param int64 None (optional) - * @param _float None (optional) - * @param string None (optional) - * @param binary None (optional) - * @param date None (optional) - * @param dateTime None (optional) - * @param password None (optional) - * @param paramCallback None (optional) - * @throws ApiException if fails to make API call - */ - public void testEndpointParameters(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, byte[] binary, LocalDate date, DateTime dateTime, String password, String paramCallback) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'number' is set - if (number == null) { - throw new ApiException(400, "Missing the required parameter 'number' when calling testEndpointParameters"); - } - - // verify the required parameter '_double' is set - if (_double == null) { - throw new ApiException(400, "Missing the required parameter '_double' when calling testEndpointParameters"); - } - - // verify the required parameter 'patternWithoutDelimiter' is set - if (patternWithoutDelimiter == null) { - throw new ApiException(400, "Missing the required parameter 'patternWithoutDelimiter' when calling testEndpointParameters"); - } - - // verify the required parameter '_byte' is set - if (_byte == null) { - throw new ApiException(400, "Missing the required parameter '_byte' when calling testEndpointParameters"); - } - - // create path and map variables - String localVarPath = "/fake".replaceAll("\\{format\\}","json"); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - if (integer != null) - localVarFormParams.put("integer", integer); -if (int32 != null) - localVarFormParams.put("int32", int32); -if (int64 != null) - localVarFormParams.put("int64", int64); -if (number != null) - localVarFormParams.put("number", number); -if (_float != null) - localVarFormParams.put("float", _float); -if (_double != null) - localVarFormParams.put("double", _double); -if (string != null) - localVarFormParams.put("string", string); -if (patternWithoutDelimiter != null) - localVarFormParams.put("pattern_without_delimiter", patternWithoutDelimiter); -if (_byte != null) - localVarFormParams.put("byte", _byte); -if (binary != null) - localVarFormParams.put("binary", binary); -if (date != null) - localVarFormParams.put("date", date); -if (dateTime != null) - localVarFormParams.put("dateTime", dateTime); -if (password != null) - localVarFormParams.put("password", password); -if (paramCallback != null) - localVarFormParams.put("callback", paramCallback); - - final String[] localVarAccepts = { - "application/xml; charset=utf-8", "application/json; charset=utf-8" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/xml; charset=utf-8", "application/json; charset=utf-8" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "http_basic_test" }; - - - apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); - } - /** - * To test enum parameters - * To test enum parameters - * @param enumFormStringArray Form parameter enum test (string array) (optional) - * @param enumFormString Form parameter enum test (string) (optional, default to -efg) - * @param enumHeaderStringArray Header parameter enum test (string array) (optional) - * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) - * @param enumQueryStringArray Query parameter enum test (string array) (optional) - * @param enumQueryString Query parameter enum test (string) (optional, default to -efg) - * @param enumQueryInteger Query parameter enum test (double) (optional) - * @param enumQueryDouble Query parameter enum test (double) (optional) - * @throws ApiException if fails to make API call - */ - public void testEnumParameters(List enumFormStringArray, String enumFormString, List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/fake".replaceAll("\\{format\\}","json"); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPairs("csv", "enum_query_string_array", enumQueryStringArray)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "enum_query_string", enumQueryString)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "enum_query_integer", enumQueryInteger)); - - if (enumHeaderStringArray != null) - localVarHeaderParams.put("enum_header_string_array", apiClient.parameterToString(enumHeaderStringArray)); -if (enumHeaderString != null) - localVarHeaderParams.put("enum_header_string", apiClient.parameterToString(enumHeaderString)); - - if (enumFormStringArray != null) - localVarFormParams.put("enum_form_string_array", enumFormStringArray); -if (enumFormString != null) - localVarFormParams.put("enum_form_string", enumFormString); -if (enumQueryDouble != null) - localVarFormParams.put("enum_query_double", enumQueryDouble); - - final String[] localVarAccepts = { - "*/*" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "*/*" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - - apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); - } -} +package io.swagger.client.api; + +import io.swagger.client.ApiException; +import io.swagger.client.ApiClient; +import io.swagger.client.Configuration; +import io.swagger.client.Pair; + +import javax.ws.rs.core.GenericType; + +import java.math.BigDecimal; +import io.swagger.client.model.Client; +import org.joda.time.DateTime; +import org.joda.time.LocalDate; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +public class FakeApi { + private ApiClient apiClient; + + public FakeApi() { + this(Configuration.getDefaultApiClient()); + } + + public FakeApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * To test \"client\" model + * To test \"client\" model + * @param body client model (required) + * @return Client + * @throws ApiException if fails to make API call + */ + public Client testClientModel(Client body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException(400, "Missing the required parameter 'body' when calling testClientModel"); + } + + // create path and map variables + String localVarPath = "/fake".replaceAll("\\{format\\}","json"); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "PATCH", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * @param number None (required) + * @param _double None (required) + * @param patternWithoutDelimiter None (required) + * @param _byte None (required) + * @param integer None (optional) + * @param int32 None (optional) + * @param int64 None (optional) + * @param _float None (optional) + * @param string None (optional) + * @param binary None (optional) + * @param date None (optional) + * @param dateTime None (optional) + * @param password None (optional) + * @param paramCallback None (optional) + * @throws ApiException if fails to make API call + */ + public void testEndpointParameters(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, byte[] binary, LocalDate date, DateTime dateTime, String password, String paramCallback) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'number' is set + if (number == null) { + throw new ApiException(400, "Missing the required parameter 'number' when calling testEndpointParameters"); + } + + // verify the required parameter '_double' is set + if (_double == null) { + throw new ApiException(400, "Missing the required parameter '_double' when calling testEndpointParameters"); + } + + // verify the required parameter 'patternWithoutDelimiter' is set + if (patternWithoutDelimiter == null) { + throw new ApiException(400, "Missing the required parameter 'patternWithoutDelimiter' when calling testEndpointParameters"); + } + + // verify the required parameter '_byte' is set + if (_byte == null) { + throw new ApiException(400, "Missing the required parameter '_byte' when calling testEndpointParameters"); + } + + // create path and map variables + String localVarPath = "/fake".replaceAll("\\{format\\}","json"); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + if (integer != null) + localVarFormParams.put("integer", integer); +if (int32 != null) + localVarFormParams.put("int32", int32); +if (int64 != null) + localVarFormParams.put("int64", int64); +if (number != null) + localVarFormParams.put("number", number); +if (_float != null) + localVarFormParams.put("float", _float); +if (_double != null) + localVarFormParams.put("double", _double); +if (string != null) + localVarFormParams.put("string", string); +if (patternWithoutDelimiter != null) + localVarFormParams.put("pattern_without_delimiter", patternWithoutDelimiter); +if (_byte != null) + localVarFormParams.put("byte", _byte); +if (binary != null) + localVarFormParams.put("binary", binary); +if (date != null) + localVarFormParams.put("date", date); +if (dateTime != null) + localVarFormParams.put("dateTime", dateTime); +if (password != null) + localVarFormParams.put("password", password); +if (paramCallback != null) + localVarFormParams.put("callback", paramCallback); + + final String[] localVarAccepts = { + "application/xml; charset=utf-8", "application/json; charset=utf-8" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/xml; charset=utf-8", "application/json; charset=utf-8" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "http_basic_test" }; + + + apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); + } + /** + * To test enum parameters + * To test enum parameters + * @param enumFormStringArray Form parameter enum test (string array) (optional) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + * @param enumHeaderStringArray Header parameter enum test (string array) (optional) + * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) + * @param enumQueryStringArray Query parameter enum test (string array) (optional) + * @param enumQueryString Query parameter enum test (string) (optional, default to -efg) + * @param enumQueryInteger Query parameter enum test (double) (optional) + * @param enumQueryDouble Query parameter enum test (double) (optional) + * @throws ApiException if fails to make API call + */ + public void testEnumParameters(List enumFormStringArray, String enumFormString, List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble) throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake".replaceAll("\\{format\\}","json"); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("csv", "enum_query_string_array", enumQueryStringArray)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "enum_query_string", enumQueryString)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "enum_query_integer", enumQueryInteger)); + + if (enumHeaderStringArray != null) + localVarHeaderParams.put("enum_header_string_array", apiClient.parameterToString(enumHeaderStringArray)); +if (enumHeaderString != null) + localVarHeaderParams.put("enum_header_string", apiClient.parameterToString(enumHeaderString)); + + if (enumFormStringArray != null) + localVarFormParams.put("enum_form_string_array", enumFormStringArray); +if (enumFormString != null) + localVarFormParams.put("enum_form_string", enumFormString); +if (enumQueryDouble != null) + localVarFormParams.put("enum_query_double", enumQueryDouble); + + final String[] localVarAccepts = { + "*/*" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "*/*" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + + apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); + } +} diff --git a/samples/client/petstore/java/resteasy/src/main/java/io/swagger/client/api/PetApi.java b/samples/client/petstore/java/resteasy/src/main/java/io/swagger/client/api/PetApi.java index 236fbc34b490..131088873d17 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/io/swagger/client/api/PetApi.java +++ b/samples/client/petstore/java/resteasy/src/main/java/io/swagger/client/api/PetApi.java @@ -1,384 +1,384 @@ -package io.swagger.client.api; - -import io.swagger.client.ApiException; -import io.swagger.client.ApiClient; -import io.swagger.client.Configuration; -import io.swagger.client.Pair; - -import javax.ws.rs.core.GenericType; - -import java.io.File; -import io.swagger.client.model.ModelApiResponse; -import io.swagger.client.model.Pet; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - - -public class PetApi { - private ApiClient apiClient; - - public PetApi() { - this(Configuration.getDefaultApiClient()); - } - - public PetApi(ApiClient apiClient) { - this.apiClient = apiClient; - } - - public ApiClient getApiClient() { - return apiClient; - } - - public void setApiClient(ApiClient apiClient) { - this.apiClient = apiClient; - } - - /** - * Add a new pet to the store - * - * @param body Pet object that needs to be added to the store (required) - * @throws ApiException if fails to make API call - */ - public void addPet(Pet body) throws ApiException { - Object localVarPostBody = body; - - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling addPet"); - } - - // create path and map variables - String localVarPath = "/pet".replaceAll("\\{format\\}","json"); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - final String[] localVarAccepts = { - "application/xml", "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json", "application/xml" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "petstore_auth" }; - - - apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); - } - /** - * Deletes a pet - * - * @param petId Pet id to delete (required) - * @param apiKey (optional) - * @throws ApiException if fails to make API call - */ - public void deletePet(Long petId, String apiKey) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'petId' is set - if (petId == null) { - throw new ApiException(400, "Missing the required parameter 'petId' when calling deletePet"); - } - - // create path and map variables - String localVarPath = "/pet/{petId}".replaceAll("\\{format\\}","json") - .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (apiKey != null) - localVarHeaderParams.put("api_key", apiClient.parameterToString(apiKey)); - - - final String[] localVarAccepts = { - "application/xml", "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "petstore_auth" }; - - - apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); - } - /** - * Finds Pets by status - * Multiple status values can be provided with comma separated strings - * @param status Status values that need to be considered for filter (required) - * @return List - * @throws ApiException if fails to make API call - */ - public List findPetsByStatus(List status) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'status' is set - if (status == null) { - throw new ApiException(400, "Missing the required parameter 'status' when calling findPetsByStatus"); - } - - // create path and map variables - String localVarPath = "/pet/findByStatus".replaceAll("\\{format\\}","json"); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPairs("csv", "status", status)); - - - - final String[] localVarAccepts = { - "application/xml", "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "petstore_auth" }; - - GenericType> localVarReturnType = new GenericType>() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Finds Pets by tags - * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - * @param tags Tags to filter by (required) - * @return List - * @throws ApiException if fails to make API call - */ - public List findPetsByTags(List tags) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'tags' is set - if (tags == null) { - throw new ApiException(400, "Missing the required parameter 'tags' when calling findPetsByTags"); - } - - // create path and map variables - String localVarPath = "/pet/findByTags".replaceAll("\\{format\\}","json"); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPairs("csv", "tags", tags)); - - - - final String[] localVarAccepts = { - "application/xml", "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "petstore_auth" }; - - GenericType> localVarReturnType = new GenericType>() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Find pet by ID - * Returns a single pet - * @param petId ID of pet to return (required) - * @return Pet - * @throws ApiException if fails to make API call - */ - public Pet getPetById(Long petId) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'petId' is set - if (petId == null) { - throw new ApiException(400, "Missing the required parameter 'petId' when calling getPetById"); - } - - // create path and map variables - String localVarPath = "/pet/{petId}".replaceAll("\\{format\\}","json") - .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - final String[] localVarAccepts = { - "application/xml", "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "api_key" }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Update an existing pet - * - * @param body Pet object that needs to be added to the store (required) - * @throws ApiException if fails to make API call - */ - public void updatePet(Pet body) throws ApiException { - Object localVarPostBody = body; - - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling updatePet"); - } - - // create path and map variables - String localVarPath = "/pet".replaceAll("\\{format\\}","json"); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - final String[] localVarAccepts = { - "application/xml", "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json", "application/xml" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "petstore_auth" }; - - - apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); - } - /** - * Updates a pet in the store with form data - * - * @param petId ID of pet that needs to be updated (required) - * @param name Updated name of the pet (optional) - * @param status Updated status of the pet (optional) - * @throws ApiException if fails to make API call - */ - public void updatePetWithForm(Long petId, String name, String status) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'petId' is set - if (petId == null) { - throw new ApiException(400, "Missing the required parameter 'petId' when calling updatePetWithForm"); - } - - // create path and map variables - String localVarPath = "/pet/{petId}".replaceAll("\\{format\\}","json") - .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - if (name != null) - localVarFormParams.put("name", name); -if (status != null) - localVarFormParams.put("status", status); - - final String[] localVarAccepts = { - "application/xml", "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/x-www-form-urlencoded" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "petstore_auth" }; - - - apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); - } - /** - * uploads an image - * - * @param petId ID of pet to update (required) - * @param additionalMetadata Additional data to pass to server (optional) - * @param file file to upload (optional) - * @return ModelApiResponse - * @throws ApiException if fails to make API call - */ - public ModelApiResponse uploadFile(Long petId, String additionalMetadata, File file) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'petId' is set - if (petId == null) { - throw new ApiException(400, "Missing the required parameter 'petId' when calling uploadFile"); - } - - // create path and map variables - String localVarPath = "/pet/{petId}/uploadImage".replaceAll("\\{format\\}","json") - .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - if (additionalMetadata != null) - localVarFormParams.put("additionalMetadata", additionalMetadata); -if (file != null) - localVarFormParams.put("file", file); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "multipart/form-data" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "petstore_auth" }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } -} +package io.swagger.client.api; + +import io.swagger.client.ApiException; +import io.swagger.client.ApiClient; +import io.swagger.client.Configuration; +import io.swagger.client.Pair; + +import javax.ws.rs.core.GenericType; + +import java.io.File; +import io.swagger.client.model.ModelApiResponse; +import io.swagger.client.model.Pet; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +public class PetApi { + private ApiClient apiClient; + + public PetApi() { + this(Configuration.getDefaultApiClient()); + } + + public PetApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Add a new pet to the store + * + * @param body Pet object that needs to be added to the store (required) + * @throws ApiException if fails to make API call + */ + public void addPet(Pet body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException(400, "Missing the required parameter 'body' when calling addPet"); + } + + // create path and map variables + String localVarPath = "/pet".replaceAll("\\{format\\}","json"); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + final String[] localVarAccepts = { + "application/xml", "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json", "application/xml" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + + + apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); + } + /** + * Deletes a pet + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @throws ApiException if fails to make API call + */ + public void deletePet(Long petId, String apiKey) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException(400, "Missing the required parameter 'petId' when calling deletePet"); + } + + // create path and map variables + String localVarPath = "/pet/{petId}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (apiKey != null) + localVarHeaderParams.put("api_key", apiClient.parameterToString(apiKey)); + + + final String[] localVarAccepts = { + "application/xml", "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + + + apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); + } + /** + * Finds Pets by status + * Multiple status values can be provided with comma separated strings + * @param status Status values that need to be considered for filter (required) + * @return List + * @throws ApiException if fails to make API call + */ + public List findPetsByStatus(List status) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'status' is set + if (status == null) { + throw new ApiException(400, "Missing the required parameter 'status' when calling findPetsByStatus"); + } + + // create path and map variables + String localVarPath = "/pet/findByStatus".replaceAll("\\{format\\}","json"); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("csv", "status", status)); + + + + final String[] localVarAccepts = { + "application/xml", "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + + GenericType> localVarReturnType = new GenericType>() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Finds Pets by tags + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @param tags Tags to filter by (required) + * @return List + * @throws ApiException if fails to make API call + */ + public List findPetsByTags(List tags) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'tags' is set + if (tags == null) { + throw new ApiException(400, "Missing the required parameter 'tags' when calling findPetsByTags"); + } + + // create path and map variables + String localVarPath = "/pet/findByTags".replaceAll("\\{format\\}","json"); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("csv", "tags", tags)); + + + + final String[] localVarAccepts = { + "application/xml", "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + + GenericType> localVarReturnType = new GenericType>() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Find pet by ID + * Returns a single pet + * @param petId ID of pet to return (required) + * @return Pet + * @throws ApiException if fails to make API call + */ + public Pet getPetById(Long petId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException(400, "Missing the required parameter 'petId' when calling getPetById"); + } + + // create path and map variables + String localVarPath = "/pet/{petId}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + final String[] localVarAccepts = { + "application/xml", "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "api_key" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Update an existing pet + * + * @param body Pet object that needs to be added to the store (required) + * @throws ApiException if fails to make API call + */ + public void updatePet(Pet body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException(400, "Missing the required parameter 'body' when calling updatePet"); + } + + // create path and map variables + String localVarPath = "/pet".replaceAll("\\{format\\}","json"); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + final String[] localVarAccepts = { + "application/xml", "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json", "application/xml" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + + + apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); + } + /** + * Updates a pet in the store with form data + * + * @param petId ID of pet that needs to be updated (required) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) + * @throws ApiException if fails to make API call + */ + public void updatePetWithForm(Long petId, String name, String status) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException(400, "Missing the required parameter 'petId' when calling updatePetWithForm"); + } + + // create path and map variables + String localVarPath = "/pet/{petId}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + if (name != null) + localVarFormParams.put("name", name); +if (status != null) + localVarFormParams.put("status", status); + + final String[] localVarAccepts = { + "application/xml", "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/x-www-form-urlencoded" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + + + apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); + } + /** + * uploads an image + * + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param file file to upload (optional) + * @return ModelApiResponse + * @throws ApiException if fails to make API call + */ + public ModelApiResponse uploadFile(Long petId, String additionalMetadata, File file) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException(400, "Missing the required parameter 'petId' when calling uploadFile"); + } + + // create path and map variables + String localVarPath = "/pet/{petId}/uploadImage".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + if (additionalMetadata != null) + localVarFormParams.put("additionalMetadata", additionalMetadata); +if (file != null) + localVarFormParams.put("file", file); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "multipart/form-data" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } +} diff --git a/samples/client/petstore/java/resteasy/src/main/java/io/swagger/client/api/StoreApi.java b/samples/client/petstore/java/resteasy/src/main/java/io/swagger/client/api/StoreApi.java index bede40dada51..715d6f6f10e8 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/io/swagger/client/api/StoreApi.java +++ b/samples/client/petstore/java/resteasy/src/main/java/io/swagger/client/api/StoreApi.java @@ -1,196 +1,196 @@ -package io.swagger.client.api; - -import io.swagger.client.ApiException; -import io.swagger.client.ApiClient; -import io.swagger.client.Configuration; -import io.swagger.client.Pair; - -import javax.ws.rs.core.GenericType; - -import io.swagger.client.model.Order; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - - -public class StoreApi { - private ApiClient apiClient; - - public StoreApi() { - this(Configuration.getDefaultApiClient()); - } - - public StoreApi(ApiClient apiClient) { - this.apiClient = apiClient; - } - - public ApiClient getApiClient() { - return apiClient; - } - - public void setApiClient(ApiClient apiClient) { - this.apiClient = apiClient; - } - - /** - * Delete purchase order by ID - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * @param orderId ID of the order that needs to be deleted (required) - * @throws ApiException if fails to make API call - */ - public void deleteOrder(String orderId) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'orderId' is set - if (orderId == null) { - throw new ApiException(400, "Missing the required parameter 'orderId' when calling deleteOrder"); - } - - // create path and map variables - String localVarPath = "/store/order/{order_id}".replaceAll("\\{format\\}","json") - .replaceAll("\\{" + "order_id" + "\\}", apiClient.escapeString(orderId.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - final String[] localVarAccepts = { - "application/xml", "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - - apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); - } - /** - * Returns pet inventories by status - * Returns a map of status codes to quantities - * @return Map - * @throws ApiException if fails to make API call - */ - public Map getInventory() throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/store/inventory".replaceAll("\\{format\\}","json"); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "api_key" }; - - GenericType> localVarReturnType = new GenericType>() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Find purchase order by ID - * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - * @param orderId ID of pet that needs to be fetched (required) - * @return Order - * @throws ApiException if fails to make API call - */ - public Order getOrderById(Long orderId) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'orderId' is set - if (orderId == null) { - throw new ApiException(400, "Missing the required parameter 'orderId' when calling getOrderById"); - } - - // create path and map variables - String localVarPath = "/store/order/{order_id}".replaceAll("\\{format\\}","json") - .replaceAll("\\{" + "order_id" + "\\}", apiClient.escapeString(orderId.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - final String[] localVarAccepts = { - "application/xml", "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Place an order for a pet - * - * @param body order placed for purchasing the pet (required) - * @return Order - * @throws ApiException if fails to make API call - */ - public Order placeOrder(Order body) throws ApiException { - Object localVarPostBody = body; - - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling placeOrder"); - } - - // create path and map variables - String localVarPath = "/store/order".replaceAll("\\{format\\}","json"); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - final String[] localVarAccepts = { - "application/xml", "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } -} +package io.swagger.client.api; + +import io.swagger.client.ApiException; +import io.swagger.client.ApiClient; +import io.swagger.client.Configuration; +import io.swagger.client.Pair; + +import javax.ws.rs.core.GenericType; + +import io.swagger.client.model.Order; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +public class StoreApi { + private ApiClient apiClient; + + public StoreApi() { + this(Configuration.getDefaultApiClient()); + } + + public StoreApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Delete purchase order by ID + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @param orderId ID of the order that needs to be deleted (required) + * @throws ApiException if fails to make API call + */ + public void deleteOrder(String orderId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'orderId' is set + if (orderId == null) { + throw new ApiException(400, "Missing the required parameter 'orderId' when calling deleteOrder"); + } + + // create path and map variables + String localVarPath = "/store/order/{order_id}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "order_id" + "\\}", apiClient.escapeString(orderId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + final String[] localVarAccepts = { + "application/xml", "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + + apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); + } + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + * @return Map + * @throws ApiException if fails to make API call + */ + public Map getInventory() throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/store/inventory".replaceAll("\\{format\\}","json"); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "api_key" }; + + GenericType> localVarReturnType = new GenericType>() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * @param orderId ID of pet that needs to be fetched (required) + * @return Order + * @throws ApiException if fails to make API call + */ + public Order getOrderById(Long orderId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'orderId' is set + if (orderId == null) { + throw new ApiException(400, "Missing the required parameter 'orderId' when calling getOrderById"); + } + + // create path and map variables + String localVarPath = "/store/order/{order_id}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "order_id" + "\\}", apiClient.escapeString(orderId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + final String[] localVarAccepts = { + "application/xml", "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Place an order for a pet + * + * @param body order placed for purchasing the pet (required) + * @return Order + * @throws ApiException if fails to make API call + */ + public Order placeOrder(Order body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException(400, "Missing the required parameter 'body' when calling placeOrder"); + } + + // create path and map variables + String localVarPath = "/store/order".replaceAll("\\{format\\}","json"); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + final String[] localVarAccepts = { + "application/xml", "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } +} diff --git a/samples/client/petstore/java/resteasy/src/main/java/io/swagger/client/api/UserApi.java b/samples/client/petstore/java/resteasy/src/main/java/io/swagger/client/api/UserApi.java index 1dc60602b826..7602f4e2ba94 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/io/swagger/client/api/UserApi.java +++ b/samples/client/petstore/java/resteasy/src/main/java/io/swagger/client/api/UserApi.java @@ -1,370 +1,370 @@ -package io.swagger.client.api; - -import io.swagger.client.ApiException; -import io.swagger.client.ApiClient; -import io.swagger.client.Configuration; -import io.swagger.client.Pair; - -import javax.ws.rs.core.GenericType; - -import io.swagger.client.model.User; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - - -public class UserApi { - private ApiClient apiClient; - - public UserApi() { - this(Configuration.getDefaultApiClient()); - } - - public UserApi(ApiClient apiClient) { - this.apiClient = apiClient; - } - - public ApiClient getApiClient() { - return apiClient; - } - - public void setApiClient(ApiClient apiClient) { - this.apiClient = apiClient; - } - - /** - * Create user - * This can only be done by the logged in user. - * @param body Created user object (required) - * @throws ApiException if fails to make API call - */ - public void createUser(User body) throws ApiException { - Object localVarPostBody = body; - - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling createUser"); - } - - // create path and map variables - String localVarPath = "/user".replaceAll("\\{format\\}","json"); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - final String[] localVarAccepts = { - "application/xml", "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - - apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); - } - /** - * Creates list of users with given input array - * - * @param body List of user object (required) - * @throws ApiException if fails to make API call - */ - public void createUsersWithArrayInput(List body) throws ApiException { - Object localVarPostBody = body; - - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling createUsersWithArrayInput"); - } - - // create path and map variables - String localVarPath = "/user/createWithArray".replaceAll("\\{format\\}","json"); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - final String[] localVarAccepts = { - "application/xml", "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - - apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); - } - /** - * Creates list of users with given input array - * - * @param body List of user object (required) - * @throws ApiException if fails to make API call - */ - public void createUsersWithListInput(List body) throws ApiException { - Object localVarPostBody = body; - - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling createUsersWithListInput"); - } - - // create path and map variables - String localVarPath = "/user/createWithList".replaceAll("\\{format\\}","json"); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - final String[] localVarAccepts = { - "application/xml", "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - - apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); - } - /** - * Delete user - * This can only be done by the logged in user. - * @param username The name that needs to be deleted (required) - * @throws ApiException if fails to make API call - */ - public void deleteUser(String username) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'username' is set - if (username == null) { - throw new ApiException(400, "Missing the required parameter 'username' when calling deleteUser"); - } - - // create path and map variables - String localVarPath = "/user/{username}".replaceAll("\\{format\\}","json") - .replaceAll("\\{" + "username" + "\\}", apiClient.escapeString(username.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - final String[] localVarAccepts = { - "application/xml", "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - - apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); - } - /** - * Get user by user name - * - * @param username The name that needs to be fetched. Use user1 for testing. (required) - * @return User - * @throws ApiException if fails to make API call - */ - public User getUserByName(String username) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'username' is set - if (username == null) { - throw new ApiException(400, "Missing the required parameter 'username' when calling getUserByName"); - } - - // create path and map variables - String localVarPath = "/user/{username}".replaceAll("\\{format\\}","json") - .replaceAll("\\{" + "username" + "\\}", apiClient.escapeString(username.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - final String[] localVarAccepts = { - "application/xml", "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Logs user into the system - * - * @param username The user name for login (required) - * @param password The password for login in clear text (required) - * @return String - * @throws ApiException if fails to make API call - */ - public String loginUser(String username, String password) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'username' is set - if (username == null) { - throw new ApiException(400, "Missing the required parameter 'username' when calling loginUser"); - } - - // verify the required parameter 'password' is set - if (password == null) { - throw new ApiException(400, "Missing the required parameter 'password' when calling loginUser"); - } - - // create path and map variables - String localVarPath = "/user/login".replaceAll("\\{format\\}","json"); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPairs("", "username", username)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "password", password)); - - - - final String[] localVarAccepts = { - "application/xml", "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Logs out current logged in user session - * - * @throws ApiException if fails to make API call - */ - public void logoutUser() throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/user/logout".replaceAll("\\{format\\}","json"); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - final String[] localVarAccepts = { - "application/xml", "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - - apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); - } - /** - * Updated user - * This can only be done by the logged in user. - * @param username name that need to be deleted (required) - * @param body Updated user object (required) - * @throws ApiException if fails to make API call - */ - public void updateUser(String username, User body) throws ApiException { - Object localVarPostBody = body; - - // verify the required parameter 'username' is set - if (username == null) { - throw new ApiException(400, "Missing the required parameter 'username' when calling updateUser"); - } - - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling updateUser"); - } - - // create path and map variables - String localVarPath = "/user/{username}".replaceAll("\\{format\\}","json") - .replaceAll("\\{" + "username" + "\\}", apiClient.escapeString(username.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - final String[] localVarAccepts = { - "application/xml", "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - - apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); - } -} +package io.swagger.client.api; + +import io.swagger.client.ApiException; +import io.swagger.client.ApiClient; +import io.swagger.client.Configuration; +import io.swagger.client.Pair; + +import javax.ws.rs.core.GenericType; + +import io.swagger.client.model.User; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +public class UserApi { + private ApiClient apiClient; + + public UserApi() { + this(Configuration.getDefaultApiClient()); + } + + public UserApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Create user + * This can only be done by the logged in user. + * @param body Created user object (required) + * @throws ApiException if fails to make API call + */ + public void createUser(User body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException(400, "Missing the required parameter 'body' when calling createUser"); + } + + // create path and map variables + String localVarPath = "/user".replaceAll("\\{format\\}","json"); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + final String[] localVarAccepts = { + "application/xml", "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + + apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); + } + /** + * Creates list of users with given input array + * + * @param body List of user object (required) + * @throws ApiException if fails to make API call + */ + public void createUsersWithArrayInput(List body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException(400, "Missing the required parameter 'body' when calling createUsersWithArrayInput"); + } + + // create path and map variables + String localVarPath = "/user/createWithArray".replaceAll("\\{format\\}","json"); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + final String[] localVarAccepts = { + "application/xml", "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + + apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); + } + /** + * Creates list of users with given input array + * + * @param body List of user object (required) + * @throws ApiException if fails to make API call + */ + public void createUsersWithListInput(List body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException(400, "Missing the required parameter 'body' when calling createUsersWithListInput"); + } + + // create path and map variables + String localVarPath = "/user/createWithList".replaceAll("\\{format\\}","json"); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + final String[] localVarAccepts = { + "application/xml", "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + + apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); + } + /** + * Delete user + * This can only be done by the logged in user. + * @param username The name that needs to be deleted (required) + * @throws ApiException if fails to make API call + */ + public void deleteUser(String username) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException(400, "Missing the required parameter 'username' when calling deleteUser"); + } + + // create path and map variables + String localVarPath = "/user/{username}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "username" + "\\}", apiClient.escapeString(username.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + final String[] localVarAccepts = { + "application/xml", "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + + apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); + } + /** + * Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @return User + * @throws ApiException if fails to make API call + */ + public User getUserByName(String username) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException(400, "Missing the required parameter 'username' when calling getUserByName"); + } + + // create path and map variables + String localVarPath = "/user/{username}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "username" + "\\}", apiClient.escapeString(username.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + final String[] localVarAccepts = { + "application/xml", "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Logs user into the system + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @return String + * @throws ApiException if fails to make API call + */ + public String loginUser(String username, String password) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException(400, "Missing the required parameter 'username' when calling loginUser"); + } + + // verify the required parameter 'password' is set + if (password == null) { + throw new ApiException(400, "Missing the required parameter 'password' when calling loginUser"); + } + + // create path and map variables + String localVarPath = "/user/login".replaceAll("\\{format\\}","json"); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "username", username)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "password", password)); + + + + final String[] localVarAccepts = { + "application/xml", "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Logs out current logged in user session + * + * @throws ApiException if fails to make API call + */ + public void logoutUser() throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/user/logout".replaceAll("\\{format\\}","json"); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + final String[] localVarAccepts = { + "application/xml", "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + + apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); + } + /** + * Updated user + * This can only be done by the logged in user. + * @param username name that need to be deleted (required) + * @param body Updated user object (required) + * @throws ApiException if fails to make API call + */ + public void updateUser(String username, User body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException(400, "Missing the required parameter 'username' when calling updateUser"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException(400, "Missing the required parameter 'body' when calling updateUser"); + } + + // create path and map variables + String localVarPath = "/user/{username}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "username" + "\\}", apiClient.escapeString(username.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + final String[] localVarAccepts = { + "application/xml", "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + + apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); + } +} diff --git a/samples/client/petstore/python/petstore_api/apis/fake_api.py b/samples/client/petstore/python/petstore_api/apis/fake_api.py index b077eae34a16..f79b8f593202 100644 --- a/samples/client/petstore/python/petstore_api/apis/fake_api.py +++ b/samples/client/petstore/python/petstore_api/apis/fake_api.py @@ -97,7 +97,7 @@ class FakeApi(object): path_params = {} - query_params = {} + query_params = [] header_params = {} @@ -256,7 +256,7 @@ class FakeApi(object): path_params = {} - query_params = {} + query_params = [] header_params = {} @@ -391,14 +391,14 @@ class FakeApi(object): path_params = {} - query_params = {} + query_params = [] if 'enum_query_string_array' in params: - query_params['enum_query_string_array'] = params['enum_query_string_array'] + query_params.append(('enum_query_string_array', params['enum_query_string_array'])) collection_formats['enum_query_string_array'] = 'csv' if 'enum_query_string' in params: - query_params['enum_query_string'] = params['enum_query_string'] + query_params.append(('enum_query_string', params['enum_query_string'])) if 'enum_query_integer' in params: - query_params['enum_query_integer'] = params['enum_query_integer'] + query_params.append(('enum_query_integer', params['enum_query_integer'])) header_params = {} if 'enum_header_string_array' in params: diff --git a/samples/client/petstore/python/petstore_api/apis/pet_api.py b/samples/client/petstore/python/petstore_api/apis/pet_api.py index 776220116e76..51b6ce82540c 100644 --- a/samples/client/petstore/python/petstore_api/apis/pet_api.py +++ b/samples/client/petstore/python/petstore_api/apis/pet_api.py @@ -97,7 +97,7 @@ class PetApi(object): path_params = {} - query_params = {} + query_params = [] header_params = {} @@ -199,7 +199,7 @@ class PetApi(object): if 'pet_id' in params: path_params['petId'] = params['pet_id'] - query_params = {} + query_params = [] header_params = {} if 'api_key' in params: @@ -293,9 +293,9 @@ class PetApi(object): path_params = {} - query_params = {} + query_params = [] if 'status' in params: - query_params['status'] = params['status'] + query_params.append(('status', params['status'])) collection_formats['status'] = 'csv' header_params = {} @@ -388,9 +388,9 @@ class PetApi(object): path_params = {} - query_params = {} + query_params = [] if 'tags' in params: - query_params['tags'] = params['tags'] + query_params.append(('tags', params['tags'])) collection_formats['tags'] = 'csv' header_params = {} @@ -485,7 +485,7 @@ class PetApi(object): if 'pet_id' in params: path_params['petId'] = params['pet_id'] - query_params = {} + query_params = [] header_params = {} @@ -577,7 +577,7 @@ class PetApi(object): path_params = {} - query_params = {} + query_params = [] header_params = {} @@ -681,7 +681,7 @@ class PetApi(object): if 'pet_id' in params: path_params['petId'] = params['pet_id'] - query_params = {} + query_params = [] header_params = {} @@ -787,7 +787,7 @@ class PetApi(object): if 'pet_id' in params: path_params['petId'] = params['pet_id'] - query_params = {} + query_params = [] header_params = {} diff --git a/samples/client/petstore/python/petstore_api/apis/store_api.py b/samples/client/petstore/python/petstore_api/apis/store_api.py index c31f6a9ef838..e9d9599c3638 100644 --- a/samples/client/petstore/python/petstore_api/apis/store_api.py +++ b/samples/client/petstore/python/petstore_api/apis/store_api.py @@ -99,7 +99,7 @@ class StoreApi(object): if 'order_id' in params: path_params['order_id'] = params['order_id'] - query_params = {} + query_params = [] header_params = {} @@ -185,7 +185,7 @@ class StoreApi(object): path_params = {} - query_params = {} + query_params = [] header_params = {} @@ -283,7 +283,7 @@ class StoreApi(object): if 'order_id' in params: path_params['order_id'] = params['order_id'] - query_params = {} + query_params = [] header_params = {} @@ -375,7 +375,7 @@ class StoreApi(object): path_params = {} - query_params = {} + query_params = [] header_params = {} diff --git a/samples/client/petstore/python/petstore_api/apis/user_api.py b/samples/client/petstore/python/petstore_api/apis/user_api.py index 8ff9eeedb034..ffdad2dd60f3 100644 --- a/samples/client/petstore/python/petstore_api/apis/user_api.py +++ b/samples/client/petstore/python/petstore_api/apis/user_api.py @@ -97,7 +97,7 @@ class UserApi(object): path_params = {} - query_params = {} + query_params = [] header_params = {} @@ -191,7 +191,7 @@ class UserApi(object): path_params = {} - query_params = {} + query_params = [] header_params = {} @@ -285,7 +285,7 @@ class UserApi(object): path_params = {} - query_params = {} + query_params = [] header_params = {} @@ -381,7 +381,7 @@ class UserApi(object): if 'username' in params: path_params['username'] = params['username'] - query_params = {} + query_params = [] header_params = {} @@ -475,7 +475,7 @@ class UserApi(object): if 'username' in params: path_params['username'] = params['username'] - query_params = {} + query_params = [] header_params = {} @@ -572,11 +572,11 @@ class UserApi(object): path_params = {} - query_params = {} + query_params = [] if 'username' in params: - query_params['username'] = params['username'] + query_params.append(('username', params['username'])) if 'password' in params: - query_params['password'] = params['password'] + query_params.append(('password', params['password'])) header_params = {} @@ -662,7 +662,7 @@ class UserApi(object): path_params = {} - query_params = {} + query_params = [] header_params = {} @@ -761,7 +761,7 @@ class UserApi(object): if 'username' in params: path_params['username'] = params['username'] - query_params = {} + query_params = [] header_params = {} diff --git a/samples/client/petstore/qt5cpp/client/ApiResponse.cpp b/samples/client/petstore/qt5cpp/client/ApiResponse.cpp index 34d959e35156..575a7bec9e90 100644 --- a/samples/client/petstore/qt5cpp/client/ApiResponse.cpp +++ b/samples/client/petstore/qt5cpp/client/ApiResponse.cpp @@ -22,8 +22,12 @@ namespace Swagger { +<<<<<<< HEAD:samples/client/petstore/qt5cpp/client/ApiResponse.cpp ApiResponse::ApiResponse(QString* json) { +======= +SWGApiResponse::SWGApiResponse(QString* json) { +>>>>>>> origin/master:samples/client/petstore/qt5cpp/client/SWGApiResponse.cpp init(); this->fromJson(*json); } @@ -123,6 +127,5 @@ ApiResponse::setMessage(QString* message) { } - -} /* namespace Swagger */ +} diff --git a/samples/client/petstore/qt5cpp/client/ApiResponse.h b/samples/client/petstore/qt5cpp/client/ApiResponse.h index afa624930c2d..31e67105b0eb 100644 --- a/samples/client/petstore/qt5cpp/client/ApiResponse.h +++ b/samples/client/petstore/qt5cpp/client/ApiResponse.h @@ -58,6 +58,6 @@ private: QString* message; }; -} /* namespace Swagger */ +} #endif /* ApiResponse_H_ */ diff --git a/samples/client/petstore/qt5cpp/client/Category.cpp b/samples/client/petstore/qt5cpp/client/Category.cpp index 099ab7839a47..95a78e0bfdf3 100644 --- a/samples/client/petstore/qt5cpp/client/Category.cpp +++ b/samples/client/petstore/qt5cpp/client/Category.cpp @@ -22,8 +22,12 @@ namespace Swagger { +<<<<<<< HEAD:samples/client/petstore/qt5cpp/client/Category.cpp Category::Category(QString* json) { +======= +SWGCategory::SWGCategory(QString* json) { +>>>>>>> origin/master:samples/client/petstore/qt5cpp/client/SWGCategory.cpp init(); this->fromJson(*json); } @@ -106,6 +110,5 @@ Category::setName(QString* name) { } - -} /* namespace Swagger */ +} diff --git a/samples/client/petstore/qt5cpp/client/Category.h b/samples/client/petstore/qt5cpp/client/Category.h index da8f07def408..c230d286911d 100644 --- a/samples/client/petstore/qt5cpp/client/Category.h +++ b/samples/client/petstore/qt5cpp/client/Category.h @@ -11,7 +11,11 @@ */ /* +<<<<<<< HEAD:samples/client/petstore/qt5cpp/client/Category.h * Category.h +======= + * SWGCategory.h +>>>>>>> origin/master:samples/client/petstore/qt5cpp/client/SWGCategory.h * * A category for a pet */ @@ -54,6 +58,6 @@ private: QString* name; }; -} /* namespace Swagger */ +} #endif /* Category_H_ */ diff --git a/samples/client/petstore/qt5cpp/client/Order.cpp b/samples/client/petstore/qt5cpp/client/Order.cpp index e9eb3bc24303..4d7467bc608d 100644 --- a/samples/client/petstore/qt5cpp/client/Order.cpp +++ b/samples/client/petstore/qt5cpp/client/Order.cpp @@ -22,8 +22,12 @@ namespace Swagger { +<<<<<<< HEAD:samples/client/petstore/qt5cpp/client/Order.cpp Order::Order(QString* json) { +======= +SWGOrder::SWGOrder(QString* json) { +>>>>>>> origin/master:samples/client/petstore/qt5cpp/client/SWGOrder.cpp init(); this->fromJson(*json); } @@ -165,6 +169,5 @@ Order::setComplete(bool complete) { } - -} /* namespace Swagger */ +} diff --git a/samples/client/petstore/qt5cpp/client/Order.h b/samples/client/petstore/qt5cpp/client/Order.h index e990f05265e8..be4951e9005f 100644 --- a/samples/client/petstore/qt5cpp/client/Order.h +++ b/samples/client/petstore/qt5cpp/client/Order.h @@ -11,7 +11,11 @@ */ /* +<<<<<<< HEAD:samples/client/petstore/qt5cpp/client/Order.h * Order.h +======= + * SWGOrder.h +>>>>>>> origin/master:samples/client/petstore/qt5cpp/client/SWGOrder.h * * An order for a pets from the pet store */ @@ -71,6 +75,6 @@ private: bool complete; }; -} /* namespace Swagger */ +} #endif /* Order_H_ */ diff --git a/samples/client/petstore/qt5cpp/client/Pet.cpp b/samples/client/petstore/qt5cpp/client/Pet.cpp index f78cac3eb6c6..33d35b09f9f7 100644 --- a/samples/client/petstore/qt5cpp/client/Pet.cpp +++ b/samples/client/petstore/qt5cpp/client/Pet.cpp @@ -22,8 +22,12 @@ namespace Swagger { +<<<<<<< HEAD:samples/client/petstore/qt5cpp/client/Pet.cpp Pet::Pet(QString* json) { +======= +SWGPet::SWGPet(QString* json) { +>>>>>>> origin/master:samples/client/petstore/qt5cpp/client/SWGPet.cpp init(); this->fromJson(*json); } @@ -190,6 +194,5 @@ Pet::setStatus(QString* status) { } - -} /* namespace Swagger */ +} diff --git a/samples/client/petstore/qt5cpp/client/Pet.h b/samples/client/petstore/qt5cpp/client/Pet.h index 391437b60e91..24f001e1bdc0 100644 --- a/samples/client/petstore/qt5cpp/client/Pet.h +++ b/samples/client/petstore/qt5cpp/client/Pet.h @@ -11,7 +11,11 @@ */ /* +<<<<<<< HEAD:samples/client/petstore/qt5cpp/client/Pet.h * Pet.h +======= + * SWGPet.h +>>>>>>> origin/master:samples/client/petstore/qt5cpp/client/SWGPet.h * * A pet for sale in the pet store */ @@ -73,6 +77,6 @@ private: QString* status; }; -} /* namespace Swagger */ +} #endif /* Pet_H_ */ diff --git a/samples/client/petstore/qt5cpp/client/SWGHelpers.cpp b/samples/client/petstore/qt5cpp/client/SWGHelpers.cpp index 5b7dd31fb982..7a899b848828 100644 --- a/samples/client/petstore/qt5cpp/client/SWGHelpers.cpp +++ b/samples/client/petstore/qt5cpp/client/SWGHelpers.cpp @@ -18,6 +18,7 @@ #include #include + namespace Swagger { void @@ -130,7 +131,7 @@ setValue(void* value, QJsonValue obj, QString type, QString complexType) { else if(type.startsWith("SWG") && obj.isObject()) { // complex type QJsonObject jsonObj = obj.toObject(); - SWGObject * so = (SWGObject*)Swagger::create(type); + SWGObject * so = (SWGObject*)::Swagger::create(type); if(so != nullptr) { so->fromJsonObject(jsonObj); SWGObject **val = static_cast(value); @@ -290,4 +291,5 @@ QString stringValue(bool value) { return QString(value ? "true" : "false"); } -} /* namespace Swagger */ + +} diff --git a/samples/client/petstore/qt5cpp/client/SWGHelpers.h b/samples/client/petstore/qt5cpp/client/SWGHelpers.h index 8317d6cac1cb..4a0aee4ee702 100644 --- a/samples/client/petstore/qt5cpp/client/SWGHelpers.h +++ b/samples/client/petstore/qt5cpp/client/SWGHelpers.h @@ -16,6 +16,7 @@ #include namespace Swagger { + void setValue(void* value, QJsonValue obj, QString type, QString complexType); void toJsonArray(QList* value, QJsonArray* output, QString innerName, QString innerType); void toJsonValue(QString name, void* value, QJsonObject* output, QString type); @@ -24,6 +25,7 @@ namespace Swagger { QString stringValue(qint32 value); QString stringValue(qint64 value); QString stringValue(bool value); + } #endif // SWGHELPERS_H diff --git a/samples/client/petstore/qt5cpp/client/SWGHttpRequest.cpp b/samples/client/petstore/qt5cpp/client/SWGHttpRequest.cpp index 758d9c3526a9..fa57cc9c8a97 100644 --- a/samples/client/petstore/qt5cpp/client/SWGHttpRequest.cpp +++ b/samples/client/petstore/qt5cpp/client/SWGHttpRequest.cpp @@ -17,6 +17,8 @@ #include +namespace Swagger { + HttpRequestInput::HttpRequestInput() { initialize(); } @@ -309,3 +311,5 @@ void HttpRequestWorker::on_manager_finished(QNetworkReply *reply) { emit on_execution_finished(this); } + +} diff --git a/samples/client/petstore/qt5cpp/client/SWGHttpRequest.h b/samples/client/petstore/qt5cpp/client/SWGHttpRequest.h index 86a50ac5bf3b..a257f8463e1d 100644 --- a/samples/client/petstore/qt5cpp/client/SWGHttpRequest.h +++ b/samples/client/petstore/qt5cpp/client/SWGHttpRequest.h @@ -27,6 +27,7 @@ enum HttpRequestVarLayout {NOT_SET, ADDRESS, URL_ENCODED, MULTIPART}; +namespace Swagger { class SWGHttpRequestInputFileElement { @@ -84,4 +85,6 @@ private slots: }; +} + #endif // HTTPREQUESTWORKER_H diff --git a/samples/client/petstore/qt5cpp/client/SWGModelFactory.h b/samples/client/petstore/qt5cpp/client/SWGModelFactory.h index aa13036a3abd..78908af68ea5 100644 --- a/samples/client/petstore/qt5cpp/client/SWGModelFactory.h +++ b/samples/client/petstore/qt5cpp/client/SWGModelFactory.h @@ -14,17 +14,35 @@ #define ModelFactory_H_ +<<<<<<< HEAD #include "ApiResponse.h" #include "Category.h" #include "Order.h" #include "Pet.h" #include "Tag.h" #include "User.h" +======= +#include "SWGApiResponse.h" +#include "SWGCategory.h" +#include "SWGOrder.h" +#include "SWGPet.h" +#include "SWGTag.h" +#include "SWGUser.h" +>>>>>>> origin/master namespace Swagger { + inline void* create(QString type) { +<<<<<<< HEAD if(QString("ApiResponse").compare(type) == 0) { return new ApiResponse(); +======= + if(QString("SWGApiResponse").compare(type) == 0) { + return new SWGApiResponse(); + } + if(QString("SWGCategory").compare(type) == 0) { + return new SWGCategory(); +>>>>>>> origin/master } if(QString("Category").compare(type) == 0) { return new Category(); @@ -56,6 +74,7 @@ namespace Swagger { } return nullptr; } -} /* namespace Swagger */ + +} #endif /* ModelFactory_H_ */ diff --git a/samples/client/petstore/qt5cpp/client/SWGObject.h b/samples/client/petstore/qt5cpp/client/SWGObject.h index 97812cbe20ce..1183eb5f06ea 100644 --- a/samples/client/petstore/qt5cpp/client/SWGObject.h +++ b/samples/client/petstore/qt5cpp/client/SWGObject.h @@ -15,6 +15,8 @@ #include +namespace Swagger { + class SWGObject { public: virtual QJsonObject* asJsonObject() { @@ -33,4 +35,6 @@ class SWGObject { } }; +} + #endif /* _SWG_OBJECT_H_ */ diff --git a/samples/client/petstore/qt5cpp/client/SWGPetApi.cpp b/samples/client/petstore/qt5cpp/client/SWGPetApi.cpp index cd4d1dd9e2fc..b62bc3105f8c 100644 --- a/samples/client/petstore/qt5cpp/client/SWGPetApi.cpp +++ b/samples/client/petstore/qt5cpp/client/SWGPetApi.cpp @@ -18,6 +18,7 @@ #include namespace Swagger { + SWGPetApi::SWGPetApi() {} SWGPetApi::~SWGPetApi() {} @@ -476,7 +477,11 @@ SWGPetApi::uploadFileCallback(HttpRequestWorker * worker) { QString json(worker->response); +<<<<<<< HEAD ApiResponse* output = static_cast(create(json, QString("ApiResponse"))); +======= + SWGApiResponse* output = static_cast(create(json, QString("SWGApiResponse"))); +>>>>>>> origin/master worker->deleteLater(); @@ -484,4 +489,5 @@ SWGPetApi::uploadFileCallback(HttpRequestWorker * worker) { emit uploadFileSignal(output); } -} /* namespace Swagger */ + +} diff --git a/samples/client/petstore/qt5cpp/client/SWGPetApi.h b/samples/client/petstore/qt5cpp/client/SWGPetApi.h index 09a98c3786b4..42dcaaa3bc9c 100644 --- a/samples/client/petstore/qt5cpp/client/SWGPetApi.h +++ b/samples/client/petstore/qt5cpp/client/SWGPetApi.h @@ -18,6 +18,7 @@ #include "ApiResponse.h" #include "Pet.h" #include +#include "SWGApiResponse.h" #include "SWGHttpRequest.h" #include @@ -40,7 +41,11 @@ public: void findPetsByStatus(QList* status); void findPetsByTags(QList* tags); void getPetById(qint64 pet_id); +<<<<<<< HEAD void updatePet(Pet body); +======= + void updatePet(SWGPet body); +>>>>>>> origin/master void updatePetWithForm(qint64 pet_id, QString* name, QString* status); void uploadFile(qint64 pet_id, QString* additional_metadata, SWGHttpRequestInputFileElement* file); @@ -62,8 +67,13 @@ signals: void getPetByIdSignal(Pet* summary); void updatePetSignal(); void updatePetWithFormSignal(); +<<<<<<< HEAD void uploadFileSignal(ApiResponse* summary); +======= + void uploadFileSignal(SWGApiResponse* summary); +>>>>>>> origin/master }; + } #endif diff --git a/samples/client/petstore/qt5cpp/client/SWGStoreApi.cpp b/samples/client/petstore/qt5cpp/client/SWGStoreApi.cpp index 33b588c4375e..b89e5fc552c3 100644 --- a/samples/client/petstore/qt5cpp/client/SWGStoreApi.cpp +++ b/samples/client/petstore/qt5cpp/client/SWGStoreApi.cpp @@ -18,6 +18,7 @@ #include namespace Swagger { + SWGStoreApi::SWGStoreApi() {} SWGStoreApi::~SWGStoreApi() {} @@ -210,4 +211,5 @@ SWGStoreApi::placeOrderCallback(HttpRequestWorker * worker) { emit placeOrderSignal(output); } -} /* namespace Swagger */ + +} diff --git a/samples/client/petstore/qt5cpp/client/SWGStoreApi.h b/samples/client/petstore/qt5cpp/client/SWGStoreApi.h index 81c825fba921..c755695f57df 100644 --- a/samples/client/petstore/qt5cpp/client/SWGStoreApi.h +++ b/samples/client/petstore/qt5cpp/client/SWGStoreApi.h @@ -37,7 +37,11 @@ public: void deleteOrder(QString* order_id); void getInventory(); void getOrderById(qint64 order_id); +<<<<<<< HEAD void placeOrder(Order body); +======= + void placeOrder(SWGOrder body); +>>>>>>> origin/master private: void deleteOrderCallback (HttpRequestWorker * worker); @@ -52,5 +56,6 @@ signals: void placeOrderSignal(Order* summary); }; + } #endif diff --git a/samples/client/petstore/qt5cpp/client/SWGUserApi.cpp b/samples/client/petstore/qt5cpp/client/SWGUserApi.cpp index 23023a48a583..0f550a2e1463 100644 --- a/samples/client/petstore/qt5cpp/client/SWGUserApi.cpp +++ b/samples/client/petstore/qt5cpp/client/SWGUserApi.cpp @@ -18,6 +18,7 @@ #include namespace Swagger { + SWGUserApi::SWGUserApi() {} SWGUserApi::~SWGUserApi() {} @@ -385,4 +386,5 @@ SWGUserApi::updateUserCallback(HttpRequestWorker * worker) { emit updateUserSignal(); } -} /* namespace Swagger */ + +} diff --git a/samples/client/petstore/qt5cpp/client/SWGUserApi.h b/samples/client/petstore/qt5cpp/client/SWGUserApi.h index a817d12f6489..58f85e099578 100644 --- a/samples/client/petstore/qt5cpp/client/SWGUserApi.h +++ b/samples/client/petstore/qt5cpp/client/SWGUserApi.h @@ -64,5 +64,6 @@ signals: void updateUserSignal(); }; + } #endif diff --git a/samples/client/petstore/qt5cpp/client/Tag.cpp b/samples/client/petstore/qt5cpp/client/Tag.cpp index f1237a528cd2..c10f379d0492 100644 --- a/samples/client/petstore/qt5cpp/client/Tag.cpp +++ b/samples/client/petstore/qt5cpp/client/Tag.cpp @@ -22,8 +22,12 @@ namespace Swagger { +<<<<<<< HEAD:samples/client/petstore/qt5cpp/client/Tag.cpp Tag::Tag(QString* json) { +======= +SWGTag::SWGTag(QString* json) { +>>>>>>> origin/master:samples/client/petstore/qt5cpp/client/SWGTag.cpp init(); this->fromJson(*json); } @@ -106,6 +110,5 @@ Tag::setName(QString* name) { } - -} /* namespace Swagger */ +} diff --git a/samples/client/petstore/qt5cpp/client/Tag.h b/samples/client/petstore/qt5cpp/client/Tag.h index d004de8be925..762cc31aca0f 100644 --- a/samples/client/petstore/qt5cpp/client/Tag.h +++ b/samples/client/petstore/qt5cpp/client/Tag.h @@ -11,7 +11,11 @@ */ /* +<<<<<<< HEAD:samples/client/petstore/qt5cpp/client/Tag.h * Tag.h +======= + * SWGTag.h +>>>>>>> origin/master:samples/client/petstore/qt5cpp/client/SWGTag.h * * A tag for a pet */ @@ -54,6 +58,6 @@ private: QString* name; }; -} /* namespace Swagger */ +} #endif /* Tag_H_ */ diff --git a/samples/client/petstore/qt5cpp/client/User.cpp b/samples/client/petstore/qt5cpp/client/User.cpp index d988ab195b6d..811902a776c7 100644 --- a/samples/client/petstore/qt5cpp/client/User.cpp +++ b/samples/client/petstore/qt5cpp/client/User.cpp @@ -22,8 +22,12 @@ namespace Swagger { +<<<<<<< HEAD:samples/client/petstore/qt5cpp/client/User.cpp User::User(QString* json) { +======= +SWGUser::SWGUser(QString* json) { +>>>>>>> origin/master:samples/client/petstore/qt5cpp/client/SWGUser.cpp init(); this->fromJson(*json); } @@ -205,6 +209,5 @@ User::setUserStatus(qint32 user_status) { } - -} /* namespace Swagger */ +} diff --git a/samples/client/petstore/qt5cpp/client/User.h b/samples/client/petstore/qt5cpp/client/User.h index 7adc2104a8a8..b9ccc017d2f0 100644 --- a/samples/client/petstore/qt5cpp/client/User.h +++ b/samples/client/petstore/qt5cpp/client/User.h @@ -11,7 +11,11 @@ */ /* +<<<<<<< HEAD:samples/client/petstore/qt5cpp/client/User.h * User.h +======= + * SWGUser.h +>>>>>>> origin/master:samples/client/petstore/qt5cpp/client/SWGUser.h * * A User who is purchasing from the pet store */ @@ -78,6 +82,6 @@ private: qint32 user_status; }; -} /* namespace Swagger */ +} #endif /* User_H_ */ diff --git a/samples/client/petstore/ruby/Gemfile.lock b/samples/client/petstore/ruby/Gemfile.lock index cb8128052abe..18532818d141 100644 --- a/samples/client/petstore/ruby/Gemfile.lock +++ b/samples/client/petstore/ruby/Gemfile.lock @@ -6,13 +6,13 @@ PATH typhoeus (~> 1.0, >= 1.0.1) GEM - remote: http://rubygems.org/ + remote: https://rubygems.org/ specs: ZenTest (4.11.0) addressable (2.3.8) autotest (4.4.6) ZenTest (>= 4.4.1) - autotest-fsevent (0.2.11) + autotest-fsevent (0.2.12) sys-uname autotest-growl (0.2.16) autotest-rails-pure (4.1.2) @@ -24,6 +24,7 @@ GEM ffi (1.9.8) hashdiff (0.3.0) json (1.8.3) + rake (12.0.0) rspec (3.4.0) rspec-core (~> 3.4.0) rspec-expectations (~> 3.4.0) @@ -38,7 +39,7 @@ GEM rspec-support (~> 3.4.0) rspec-support (3.4.1) safe_yaml (1.0.4) - sys-uname (0.9.2) + sys-uname (1.0.3) ffi (>= 1.0.0) typhoeus (1.0.1) ethon (>= 0.8.0) @@ -53,10 +54,14 @@ PLATFORMS DEPENDENCIES autotest (~> 4.4, >= 4.4.6) - autotest-fsevent (~> 0.2, >= 0.2.11) + autotest-fsevent (~> 0.2, >= 0.2.12) autotest-growl (~> 0.2, >= 0.2.16) autotest-rails-pure (~> 4.1, >= 4.1.2) petstore! + rake (~> 12.0.0) rspec (~> 3.4, >= 3.4.0) vcr (~> 3.0, >= 3.0.1) webmock (~> 1.24, >= 1.24.3) + +BUNDLED WITH + 1.12.3 diff --git a/samples/client/petstore/ruby/lib/petstore/api/fake_api.rb b/samples/client/petstore/ruby/lib/petstore/api/fake_api.rb index a8b7c97de208..ca371301da94 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/fake_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/fake_api.rb @@ -40,7 +40,9 @@ module Petstore @api_client.config.logger.debug "Calling API: FakeApi.test_client_model ..." end # verify the required parameter 'body' is set - fail ArgumentError, "Missing the required parameter 'body' when calling FakeApi.test_client_model" if body.nil? + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling FakeApi.test_client_model" + end # resource path local_var_path = "/fake" @@ -119,62 +121,70 @@ module Petstore @api_client.config.logger.debug "Calling API: FakeApi.test_endpoint_parameters ..." end # verify the required parameter 'number' is set - fail ArgumentError, "Missing the required parameter 'number' when calling FakeApi.test_endpoint_parameters" if number.nil? - if number > 543.2 + if @api_client.config.client_side_validation && number.nil? + fail ArgumentError, "Missing the required parameter 'number' when calling FakeApi.test_endpoint_parameters" + end + if @api_client.config.client_side_validation && number > 543.2 fail ArgumentError, 'invalid value for "number" when calling FakeApi.test_endpoint_parameters, must be smaller than or equal to 543.2.' end - if number < 32.1 + if @api_client.config.client_side_validation && number < 32.1 fail ArgumentError, 'invalid value for "number" when calling FakeApi.test_endpoint_parameters, must be greater than or equal to 32.1.' end # verify the required parameter 'double' is set - fail ArgumentError, "Missing the required parameter 'double' when calling FakeApi.test_endpoint_parameters" if double.nil? - if double > 123.4 + if @api_client.config.client_side_validation && double.nil? + fail ArgumentError, "Missing the required parameter 'double' when calling FakeApi.test_endpoint_parameters" + end + if @api_client.config.client_side_validation && double > 123.4 fail ArgumentError, 'invalid value for "double" when calling FakeApi.test_endpoint_parameters, must be smaller than or equal to 123.4.' end - if double < 67.8 + if @api_client.config.client_side_validation && double < 67.8 fail ArgumentError, 'invalid value for "double" when calling FakeApi.test_endpoint_parameters, must be greater than or equal to 67.8.' end # verify the required parameter 'pattern_without_delimiter' is set - fail ArgumentError, "Missing the required parameter 'pattern_without_delimiter' when calling FakeApi.test_endpoint_parameters" if pattern_without_delimiter.nil? - if pattern_without_delimiter !~ Regexp.new(/^[A-Z].*/) + if @api_client.config.client_side_validation && pattern_without_delimiter.nil? + fail ArgumentError, "Missing the required parameter 'pattern_without_delimiter' when calling FakeApi.test_endpoint_parameters" + end + if @api_client.config.client_side_validation && pattern_without_delimiter !~ Regexp.new(/^[A-Z].*/) fail ArgumentError, "invalid value for 'pattern_without_delimiter' when calling FakeApi.test_endpoint_parameters, must conform to the pattern /^[A-Z].*/." end # verify the required parameter 'byte' is set - fail ArgumentError, "Missing the required parameter 'byte' when calling FakeApi.test_endpoint_parameters" if byte.nil? - if !opts[:'integer'].nil? && opts[:'integer'] > 100 + if @api_client.config.client_side_validation && byte.nil? + fail ArgumentError, "Missing the required parameter 'byte' when calling FakeApi.test_endpoint_parameters" + end + if @api_client.config.client_side_validation && !opts[:'integer'].nil? && opts[:'integer'] > 100 fail ArgumentError, 'invalid value for "opts[:"integer"]" when calling FakeApi.test_endpoint_parameters, must be smaller than or equal to 100.' end - if !opts[:'integer'].nil? && opts[:'integer'] < 10 + if @api_client.config.client_side_validation && !opts[:'integer'].nil? && opts[:'integer'] < 10 fail ArgumentError, 'invalid value for "opts[:"integer"]" when calling FakeApi.test_endpoint_parameters, must be greater than or equal to 10.' end - if !opts[:'int32'].nil? && opts[:'int32'] > 200 + if @api_client.config.client_side_validation && !opts[:'int32'].nil? && opts[:'int32'] > 200 fail ArgumentError, 'invalid value for "opts[:"int32"]" when calling FakeApi.test_endpoint_parameters, must be smaller than or equal to 200.' end - if !opts[:'int32'].nil? && opts[:'int32'] < 20 + if @api_client.config.client_side_validation && !opts[:'int32'].nil? && opts[:'int32'] < 20 fail ArgumentError, 'invalid value for "opts[:"int32"]" when calling FakeApi.test_endpoint_parameters, must be greater than or equal to 20.' end - if !opts[:'float'].nil? && opts[:'float'] > 987.6 + if @api_client.config.client_side_validation && !opts[:'float'].nil? && opts[:'float'] > 987.6 fail ArgumentError, 'invalid value for "opts[:"float"]" when calling FakeApi.test_endpoint_parameters, must be smaller than or equal to 987.6.' end - if !opts[:'string'].nil? && opts[:'string'] !~ Regexp.new(/[a-z]/i) + if @api_client.config.client_side_validation && !opts[:'string'].nil? && opts[:'string'] !~ Regexp.new(/[a-z]/i) fail ArgumentError, "invalid value for 'opts[:\"string\"]' when calling FakeApi.test_endpoint_parameters, must conform to the pattern /[a-z]/i." end - if !opts[:'password'].nil? && opts[:'password'].to_s.length > 64 + if @api_client.config.client_side_validation && !opts[:'password'].nil? && opts[:'password'].to_s.length > 64 fail ArgumentError, 'invalid value for "opts[:"password"]" when calling FakeApi.test_endpoint_parameters, the character length must be smaller than or equal to 64.' end - if !opts[:'password'].nil? && opts[:'password'].to_s.length < 10 + if @api_client.config.client_side_validation && !opts[:'password'].nil? && opts[:'password'].to_s.length < 10 fail ArgumentError, 'invalid value for "opts[:"password"]" when calling FakeApi.test_endpoint_parameters, the character length must be great than or equal to 10.' end @@ -256,28 +266,28 @@ module Petstore if @api_client.config.debugging @api_client.config.logger.debug "Calling API: FakeApi.test_enum_parameters ..." end - if opts[:'enum_form_string_array'] && !opts[:'enum_form_string_array'].all?{|item| ['>', '$'].include?(item)} + if @api_client.config.client_side_validation && opts[:'enum_form_string_array'] && !opts[:'enum_form_string_array'].all?{|item| ['>', '$'].include?(item)} fail ArgumentError, 'invalid value for "enum_form_string_array", must include one of >, $' end - if opts[:'enum_form_string'] && !['_abc', '-efg', '(xyz)'].include?(opts[:'enum_form_string']) + if @api_client.config.client_side_validation && opts[:'enum_form_string'] && !['_abc', '-efg', '(xyz)'].include?(opts[:'enum_form_string']) fail ArgumentError, 'invalid value for "enum_form_string", must be one of _abc, -efg, (xyz)' end - if opts[:'enum_header_string_array'] && !opts[:'enum_header_string_array'].all?{|item| ['>', '$'].include?(item)} + if @api_client.config.client_side_validation && opts[:'enum_header_string_array'] && !opts[:'enum_header_string_array'].all?{|item| ['>', '$'].include?(item)} fail ArgumentError, 'invalid value for "enum_header_string_array", must include one of >, $' end - if opts[:'enum_header_string'] && !['_abc', '-efg', '(xyz)'].include?(opts[:'enum_header_string']) + if @api_client.config.client_side_validation && opts[:'enum_header_string'] && !['_abc', '-efg', '(xyz)'].include?(opts[:'enum_header_string']) fail ArgumentError, 'invalid value for "enum_header_string", must be one of _abc, -efg, (xyz)' end - if opts[:'enum_query_string_array'] && !opts[:'enum_query_string_array'].all?{|item| ['>', '$'].include?(item)} + if @api_client.config.client_side_validation && opts[:'enum_query_string_array'] && !opts[:'enum_query_string_array'].all?{|item| ['>', '$'].include?(item)} fail ArgumentError, 'invalid value for "enum_query_string_array", must include one of >, $' end - if opts[:'enum_query_string'] && !['_abc', '-efg', '(xyz)'].include?(opts[:'enum_query_string']) + if @api_client.config.client_side_validation && opts[:'enum_query_string'] && !['_abc', '-efg', '(xyz)'].include?(opts[:'enum_query_string']) fail ArgumentError, 'invalid value for "enum_query_string", must be one of _abc, -efg, (xyz)' end - if opts[:'enum_query_integer'] && !['1', '-2'].include?(opts[:'enum_query_integer']) + if @api_client.config.client_side_validation && opts[:'enum_query_integer'] && !['1', '-2'].include?(opts[:'enum_query_integer']) fail ArgumentError, 'invalid value for "enum_query_integer", must be one of 1, -2' end - if opts[:'enum_query_double'] && !['1.1', '-1.2'].include?(opts[:'enum_query_double']) + if @api_client.config.client_side_validation && opts[:'enum_query_double'] && !['1.1', '-1.2'].include?(opts[:'enum_query_double']) fail ArgumentError, 'invalid value for "enum_query_double", must be one of 1.1, -1.2' end # resource path diff --git a/samples/client/petstore/ruby/lib/petstore/api/pet_api.rb b/samples/client/petstore/ruby/lib/petstore/api/pet_api.rb index 6c8fad3e3a60..db02c4f4ef32 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/pet_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/pet_api.rb @@ -40,7 +40,9 @@ module Petstore @api_client.config.logger.debug "Calling API: PetApi.add_pet ..." end # verify the required parameter 'body' is set - fail ArgumentError, "Missing the required parameter 'body' when calling PetApi.add_pet" if body.nil? + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling PetApi.add_pet" + end # resource path local_var_path = "/pet" @@ -94,7 +96,9 @@ module Petstore @api_client.config.logger.debug "Calling API: PetApi.delete_pet ..." end # verify the required parameter 'pet_id' is set - fail ArgumentError, "Missing the required parameter 'pet_id' when calling PetApi.delete_pet" if pet_id.nil? + if @api_client.config.client_side_validation && pet_id.nil? + fail ArgumentError, "Missing the required parameter 'pet_id' when calling PetApi.delete_pet" + end # resource path local_var_path = "/pet/{petId}".sub('{' + 'petId' + '}', pet_id.to_s) @@ -145,7 +149,9 @@ module Petstore @api_client.config.logger.debug "Calling API: PetApi.find_pets_by_status ..." end # verify the required parameter 'status' is set - fail ArgumentError, "Missing the required parameter 'status' when calling PetApi.find_pets_by_status" if status.nil? + if @api_client.config.client_side_validation && status.nil? + fail ArgumentError, "Missing the required parameter 'status' when calling PetApi.find_pets_by_status" + end # resource path local_var_path = "/pet/findByStatus" @@ -197,7 +203,9 @@ module Petstore @api_client.config.logger.debug "Calling API: PetApi.find_pets_by_tags ..." end # verify the required parameter 'tags' is set - fail ArgumentError, "Missing the required parameter 'tags' when calling PetApi.find_pets_by_tags" if tags.nil? + if @api_client.config.client_side_validation && tags.nil? + fail ArgumentError, "Missing the required parameter 'tags' when calling PetApi.find_pets_by_tags" + end # resource path local_var_path = "/pet/findByTags" @@ -249,7 +257,9 @@ module Petstore @api_client.config.logger.debug "Calling API: PetApi.get_pet_by_id ..." end # verify the required parameter 'pet_id' is set - fail ArgumentError, "Missing the required parameter 'pet_id' when calling PetApi.get_pet_by_id" if pet_id.nil? + if @api_client.config.client_side_validation && pet_id.nil? + fail ArgumentError, "Missing the required parameter 'pet_id' when calling PetApi.get_pet_by_id" + end # resource path local_var_path = "/pet/{petId}".sub('{' + 'petId' + '}', pet_id.to_s) @@ -300,7 +310,9 @@ module Petstore @api_client.config.logger.debug "Calling API: PetApi.update_pet ..." end # verify the required parameter 'body' is set - fail ArgumentError, "Missing the required parameter 'body' when calling PetApi.update_pet" if body.nil? + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling PetApi.update_pet" + end # resource path local_var_path = "/pet" @@ -356,7 +368,9 @@ module Petstore @api_client.config.logger.debug "Calling API: PetApi.update_pet_with_form ..." end # verify the required parameter 'pet_id' is set - fail ArgumentError, "Missing the required parameter 'pet_id' when calling PetApi.update_pet_with_form" if pet_id.nil? + if @api_client.config.client_side_validation && pet_id.nil? + fail ArgumentError, "Missing the required parameter 'pet_id' when calling PetApi.update_pet_with_form" + end # resource path local_var_path = "/pet/{petId}".sub('{' + 'petId' + '}', pet_id.to_s) @@ -414,7 +428,9 @@ module Petstore @api_client.config.logger.debug "Calling API: PetApi.upload_file ..." end # verify the required parameter 'pet_id' is set - fail ArgumentError, "Missing the required parameter 'pet_id' when calling PetApi.upload_file" if pet_id.nil? + if @api_client.config.client_side_validation && pet_id.nil? + fail ArgumentError, "Missing the required parameter 'pet_id' when calling PetApi.upload_file" + end # resource path local_var_path = "/pet/{petId}/uploadImage".sub('{' + 'petId' + '}', pet_id.to_s) diff --git a/samples/client/petstore/ruby/lib/petstore/api/store_api.rb b/samples/client/petstore/ruby/lib/petstore/api/store_api.rb index c56f3da84864..4b7ce13c894d 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/store_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/store_api.rb @@ -40,7 +40,9 @@ module Petstore @api_client.config.logger.debug "Calling API: StoreApi.delete_order ..." end # verify the required parameter 'order_id' is set - fail ArgumentError, "Missing the required parameter 'order_id' when calling StoreApi.delete_order" if order_id.nil? + if @api_client.config.client_side_validation && order_id.nil? + fail ArgumentError, "Missing the required parameter 'order_id' when calling StoreApi.delete_order" + end # resource path local_var_path = "/store/order/{order_id}".sub('{' + 'order_id' + '}', order_id.to_s) @@ -137,12 +139,14 @@ module Petstore @api_client.config.logger.debug "Calling API: StoreApi.get_order_by_id ..." end # verify the required parameter 'order_id' is set - fail ArgumentError, "Missing the required parameter 'order_id' when calling StoreApi.get_order_by_id" if order_id.nil? - if order_id > 5 + if @api_client.config.client_side_validation && order_id.nil? + fail ArgumentError, "Missing the required parameter 'order_id' when calling StoreApi.get_order_by_id" + end + if @api_client.config.client_side_validation && order_id > 5 fail ArgumentError, 'invalid value for "order_id" when calling StoreApi.get_order_by_id, must be smaller than or equal to 5.' end - if order_id < 1 + if @api_client.config.client_side_validation && order_id < 1 fail ArgumentError, 'invalid value for "order_id" when calling StoreApi.get_order_by_id, must be greater than or equal to 1.' end @@ -196,7 +200,9 @@ module Petstore @api_client.config.logger.debug "Calling API: StoreApi.place_order ..." end # verify the required parameter 'body' is set - fail ArgumentError, "Missing the required parameter 'body' when calling StoreApi.place_order" if body.nil? + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling StoreApi.place_order" + end # resource path local_var_path = "/store/order" diff --git a/samples/client/petstore/ruby/lib/petstore/api/user_api.rb b/samples/client/petstore/ruby/lib/petstore/api/user_api.rb index a83bed3626ac..a71e20528bae 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/user_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/user_api.rb @@ -40,7 +40,9 @@ module Petstore @api_client.config.logger.debug "Calling API: UserApi.create_user ..." end # verify the required parameter 'body' is set - fail ArgumentError, "Missing the required parameter 'body' when calling UserApi.create_user" if body.nil? + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling UserApi.create_user" + end # resource path local_var_path = "/user" @@ -90,7 +92,9 @@ module Petstore @api_client.config.logger.debug "Calling API: UserApi.create_users_with_array_input ..." end # verify the required parameter 'body' is set - fail ArgumentError, "Missing the required parameter 'body' when calling UserApi.create_users_with_array_input" if body.nil? + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling UserApi.create_users_with_array_input" + end # resource path local_var_path = "/user/createWithArray" @@ -140,7 +144,9 @@ module Petstore @api_client.config.logger.debug "Calling API: UserApi.create_users_with_list_input ..." end # verify the required parameter 'body' is set - fail ArgumentError, "Missing the required parameter 'body' when calling UserApi.create_users_with_list_input" if body.nil? + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling UserApi.create_users_with_list_input" + end # resource path local_var_path = "/user/createWithList" @@ -190,7 +196,9 @@ module Petstore @api_client.config.logger.debug "Calling API: UserApi.delete_user ..." end # verify the required parameter 'username' is set - fail ArgumentError, "Missing the required parameter 'username' when calling UserApi.delete_user" if username.nil? + if @api_client.config.client_side_validation && username.nil? + fail ArgumentError, "Missing the required parameter 'username' when calling UserApi.delete_user" + end # resource path local_var_path = "/user/{username}".sub('{' + 'username' + '}', username.to_s) @@ -240,7 +248,9 @@ module Petstore @api_client.config.logger.debug "Calling API: UserApi.get_user_by_name ..." end # verify the required parameter 'username' is set - fail ArgumentError, "Missing the required parameter 'username' when calling UserApi.get_user_by_name" if username.nil? + if @api_client.config.client_side_validation && username.nil? + fail ArgumentError, "Missing the required parameter 'username' when calling UserApi.get_user_by_name" + end # resource path local_var_path = "/user/{username}".sub('{' + 'username' + '}', username.to_s) @@ -293,9 +303,13 @@ module Petstore @api_client.config.logger.debug "Calling API: UserApi.login_user ..." end # verify the required parameter 'username' is set - fail ArgumentError, "Missing the required parameter 'username' when calling UserApi.login_user" if username.nil? + if @api_client.config.client_side_validation && username.nil? + fail ArgumentError, "Missing the required parameter 'username' when calling UserApi.login_user" + end # verify the required parameter 'password' is set - fail ArgumentError, "Missing the required parameter 'password' when calling UserApi.login_user" if password.nil? + if @api_client.config.client_side_validation && password.nil? + fail ArgumentError, "Missing the required parameter 'password' when calling UserApi.login_user" + end # resource path local_var_path = "/user/login" @@ -396,9 +410,13 @@ module Petstore @api_client.config.logger.debug "Calling API: UserApi.update_user ..." end # verify the required parameter 'username' is set - fail ArgumentError, "Missing the required parameter 'username' when calling UserApi.update_user" if username.nil? + if @api_client.config.client_side_validation && username.nil? + fail ArgumentError, "Missing the required parameter 'username' when calling UserApi.update_user" + end # verify the required parameter 'body' is set - fail ArgumentError, "Missing the required parameter 'body' when calling UserApi.update_user" if body.nil? + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling UserApi.update_user" + end # resource path local_var_path = "/user/{username}".sub('{' + 'username' + '}', username.to_s) diff --git a/samples/client/petstore/ruby/lib/petstore/configuration.rb b/samples/client/petstore/ruby/lib/petstore/configuration.rb index 1020def23a1c..f1c706e4aec7 100644 --- a/samples/client/petstore/ruby/lib/petstore/configuration.rb +++ b/samples/client/petstore/ruby/lib/petstore/configuration.rb @@ -76,6 +76,11 @@ module Petstore # Default to 0 (never times out). attr_accessor :timeout + # Set this to false to skip client side validation in the operation. + # Default to true. + # @return [true, false] + attr_accessor :client_side_validation + ### TLS/SSL setting # Set this to false to skip verifying SSL certificate when calling API from https server. # Default to true. @@ -129,6 +134,7 @@ module Petstore @api_key = {} @api_key_prefix = {} @timeout = 0 + @client_side_validation = true @verify_ssl = true @verify_ssl_host = true @params_encoding = nil diff --git a/samples/client/petstore/ruby/petstore.gemspec b/samples/client/petstore/ruby/petstore.gemspec index ee05954eb8bf..846b2ac60eeb 100644 --- a/samples/client/petstore/ruby/petstore.gemspec +++ b/samples/client/petstore/ruby/petstore.gemspec @@ -37,7 +37,7 @@ Gem::Specification.new do |s| s.add_development_dependency 'autotest', '~> 4.4', '>= 4.4.6' s.add_development_dependency 'autotest-rails-pure', '~> 4.1', '>= 4.1.2' s.add_development_dependency 'autotest-growl', '~> 0.2', '>= 0.2.16' - s.add_development_dependency 'autotest-fsevent', '~> 0.2', '>= 0.2.11' + s.add_development_dependency 'autotest-fsevent', '~> 0.2', '>= 0.2.12' s.files = `find *`.split("\n").uniq.sort.select{|f| !f.empty? } s.test_files = `find spec/*`.split("\n") diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models.swift index a25903a430f9..930bf97ff07d 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models.swift @@ -257,7 +257,6 @@ class Decoders { // Decoder for AdditionalPropertiesClass Decoders.addDecoder(clazz: AdditionalPropertiesClass.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? AdditionalPropertiesClass() : instance as! AdditionalPropertiesClass switch Decoders.decodeOptional(clazz: [String:String].self, source: sourceDictionary["map_property"] as AnyObject?) { @@ -288,7 +287,6 @@ class Decoders { if let discriminator = sourceDictionary["className"] as? String, instance == nil && discriminator != "Animal"{ return Decoders.decode(clazz: Animal.self, discriminator: discriminator, source: source) } - let result = instance == nil ? Animal() : instance as! Animal switch Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["className"] as AnyObject?) { @@ -318,7 +316,6 @@ class Decoders { // Decoder for ApiResponse Decoders.addDecoder(clazz: ApiResponse.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? ApiResponse() : instance as! ApiResponse switch Decoders.decodeOptional(clazz: Int32.self, source: sourceDictionary["code"] as AnyObject?) { @@ -351,7 +348,6 @@ class Decoders { // Decoder for ArrayOfArrayOfNumberOnly Decoders.addDecoder(clazz: ArrayOfArrayOfNumberOnly.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? ArrayOfArrayOfNumberOnly() : instance as! ArrayOfArrayOfNumberOnly switch Decoders.decodeOptional(clazz: [[Double]].self, source: sourceDictionary["ArrayArrayNumber"] as AnyObject?) { @@ -372,7 +368,6 @@ class Decoders { // Decoder for ArrayOfNumberOnly Decoders.addDecoder(clazz: ArrayOfNumberOnly.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? ArrayOfNumberOnly() : instance as! ArrayOfNumberOnly switch Decoders.decodeOptional(clazz: [Double].self, source: sourceDictionary["ArrayNumber"] as AnyObject?) { @@ -393,7 +388,6 @@ class Decoders { // Decoder for ArrayTest Decoders.addDecoder(clazz: ArrayTest.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? ArrayTest() : instance as! ArrayTest switch Decoders.decodeOptional(clazz: [String].self, source: sourceDictionary["array_of_string"] as AnyObject?) { @@ -426,7 +420,6 @@ class Decoders { // Decoder for Capitalization Decoders.addDecoder(clazz: Capitalization.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? Capitalization() : instance as! Capitalization switch Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["smallCamel"] as AnyObject?) { @@ -477,7 +470,6 @@ class Decoders { // Decoder for Cat Decoders.addDecoder(clazz: Cat.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? Cat() : instance as! Cat if decoders["\(Animal.self)"] != nil { _ = Decoders.decode(clazz: Animal.self, source: source, instance: result) @@ -513,7 +505,6 @@ class Decoders { // Decoder for Category Decoders.addDecoder(clazz: Category.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? Category() : instance as! Category switch Decoders.decodeOptional(clazz: Int64.self, source: sourceDictionary["id"] as AnyObject?) { @@ -540,7 +531,6 @@ class Decoders { // Decoder for ClassModel Decoders.addDecoder(clazz: ClassModel.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? ClassModel() : instance as! ClassModel switch Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["_class"] as AnyObject?) { @@ -561,7 +551,6 @@ class Decoders { // Decoder for Client Decoders.addDecoder(clazz: Client.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? Client() : instance as! Client switch Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["client"] as AnyObject?) { @@ -582,7 +571,6 @@ class Decoders { // Decoder for Dog Decoders.addDecoder(clazz: Dog.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? Dog() : instance as! Dog if decoders["\(Animal.self)"] != nil { _ = Decoders.decode(clazz: Animal.self, source: source, instance: result) @@ -618,7 +606,6 @@ class Decoders { // Decoder for EnumArrays Decoders.addDecoder(clazz: EnumArrays.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? EnumArrays() : instance as! EnumArrays switch Decoders.decodeOptional(clazz: EnumArrays.JustSymbol.self, source: sourceDictionary["just_symbol"] as AnyObject?) { @@ -655,7 +642,6 @@ class Decoders { // Decoder for EnumTest Decoders.addDecoder(clazz: EnumTest.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? EnumTest() : instance as! EnumTest switch Decoders.decodeOptional(clazz: EnumTest.EnumString.self, source: sourceDictionary["enum_string"] as AnyObject?) { @@ -694,7 +680,6 @@ class Decoders { // Decoder for FormatTest Decoders.addDecoder(clazz: FormatTest.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? FormatTest() : instance as! FormatTest switch Decoders.decodeOptional(clazz: Int32.self, source: sourceDictionary["integer"] as AnyObject?) { @@ -787,7 +772,6 @@ class Decoders { // Decoder for HasOnlyReadOnly Decoders.addDecoder(clazz: HasOnlyReadOnly.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? HasOnlyReadOnly() : instance as! HasOnlyReadOnly switch Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["bar"] as AnyObject?) { @@ -814,7 +798,6 @@ class Decoders { // Decoder for List Decoders.addDecoder(clazz: List.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? List() : instance as! List switch Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["123-list"] as AnyObject?) { @@ -835,7 +818,6 @@ class Decoders { // Decoder for MapTest Decoders.addDecoder(clazz: MapTest.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? MapTest() : instance as! MapTest switch Decoders.decodeOptional(clazz: [String:[String:String]].self, source: sourceDictionary["map_map_of_string"] as AnyObject?) { @@ -862,7 +844,6 @@ class Decoders { // Decoder for MixedPropertiesAndAdditionalPropertiesClass Decoders.addDecoder(clazz: MixedPropertiesAndAdditionalPropertiesClass.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? MixedPropertiesAndAdditionalPropertiesClass() : instance as! MixedPropertiesAndAdditionalPropertiesClass switch Decoders.decodeOptional(clazz: UUID.self, source: sourceDictionary["uuid"] as AnyObject?) { @@ -895,7 +876,6 @@ class Decoders { // Decoder for Model200Response Decoders.addDecoder(clazz: Model200Response.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? Model200Response() : instance as! Model200Response switch Decoders.decodeOptional(clazz: Int32.self, source: sourceDictionary["name"] as AnyObject?) { @@ -922,7 +902,6 @@ class Decoders { // Decoder for Name Decoders.addDecoder(clazz: Name.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? Name() : instance as! Name switch Decoders.decodeOptional(clazz: Int32.self, source: sourceDictionary["name"] as AnyObject?) { @@ -961,7 +940,6 @@ class Decoders { // Decoder for NumberOnly Decoders.addDecoder(clazz: NumberOnly.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? NumberOnly() : instance as! NumberOnly switch Decoders.decodeOptional(clazz: Double.self, source: sourceDictionary["JustNumber"] as AnyObject?) { @@ -982,7 +960,6 @@ class Decoders { // Decoder for Order Decoders.addDecoder(clazz: Order.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? Order() : instance as! Order switch Decoders.decodeOptional(clazz: Int64.self, source: sourceDictionary["id"] as AnyObject?) { @@ -1043,7 +1020,6 @@ class Decoders { // Decoder for Pet Decoders.addDecoder(clazz: Pet.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? Pet() : instance as! Pet switch Decoders.decodeOptional(clazz: Int64.self, source: sourceDictionary["id"] as AnyObject?) { @@ -1094,7 +1070,6 @@ class Decoders { // Decoder for ReadOnlyFirst Decoders.addDecoder(clazz: ReadOnlyFirst.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? ReadOnlyFirst() : instance as! ReadOnlyFirst switch Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["bar"] as AnyObject?) { @@ -1121,7 +1096,6 @@ class Decoders { // Decoder for Return Decoders.addDecoder(clazz: Return.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? Return() : instance as! Return switch Decoders.decodeOptional(clazz: Int32.self, source: sourceDictionary["return"] as AnyObject?) { @@ -1142,7 +1116,6 @@ class Decoders { // Decoder for SpecialModelName Decoders.addDecoder(clazz: SpecialModelName.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? SpecialModelName() : instance as! SpecialModelName switch Decoders.decodeOptional(clazz: Int64.self, source: sourceDictionary["$special[property.name]"] as AnyObject?) { @@ -1163,7 +1136,6 @@ class Decoders { // Decoder for Tag Decoders.addDecoder(clazz: Tag.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? Tag() : instance as! Tag switch Decoders.decodeOptional(clazz: Int64.self, source: sourceDictionary["id"] as AnyObject?) { @@ -1190,7 +1162,6 @@ class Decoders { // Decoder for User Decoders.addDecoder(clazz: User.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? User() : instance as! User switch Decoders.decodeOptional(clazz: Int64.self, source: sourceDictionary["id"] as AnyObject?) { diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/AdditionalPropertiesClass.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/AdditionalPropertiesClass.swift index 1d597c725421..841becdb238b 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/AdditionalPropertiesClass.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/AdditionalPropertiesClass.swift @@ -9,6 +9,7 @@ import Foundation open class AdditionalPropertiesClass: JSONEncodable { + public var mapProperty: [String:String]? public var mapOfMapProperty: [String:[String:String]]? @@ -19,6 +20,7 @@ open class AdditionalPropertiesClass: JSONEncodable { var nillableDictionary = [String:Any?]() nillableDictionary["map_property"] = self.mapProperty?.encodeToJSON() nillableDictionary["map_of_map_property"] = self.mapOfMapProperty?.encodeToJSON() + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Animal.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Animal.swift index bcb5136be44a..057ab8e803e4 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Animal.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Animal.swift @@ -9,6 +9,7 @@ import Foundation open class Animal: JSONEncodable { + public var className: String? public var color: String? @@ -19,6 +20,7 @@ open class Animal: JSONEncodable { var nillableDictionary = [String:Any?]() nillableDictionary["className"] = self.className nillableDictionary["color"] = self.color + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/ApiResponse.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/ApiResponse.swift index 20aaed5294cd..c95f95c7afaa 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/ApiResponse.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/ApiResponse.swift @@ -9,6 +9,7 @@ import Foundation open class ApiResponse: JSONEncodable { + public var code: Int32? public var type: String? public var message: String? @@ -21,6 +22,7 @@ open class ApiResponse: JSONEncodable { nillableDictionary["code"] = self.code?.encodeToJSON() nillableDictionary["type"] = self.type nillableDictionary["message"] = self.message + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/ArrayOfArrayOfNumberOnly.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/ArrayOfArrayOfNumberOnly.swift index 6a549ca866b5..f10815e48289 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/ArrayOfArrayOfNumberOnly.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/ArrayOfArrayOfNumberOnly.swift @@ -9,6 +9,7 @@ import Foundation open class ArrayOfArrayOfNumberOnly: JSONEncodable { + public var arrayArrayNumber: [[Double]]? public init() {} @@ -17,6 +18,7 @@ open class ArrayOfArrayOfNumberOnly: JSONEncodable { open func encodeToJSON() -> Any { var nillableDictionary = [String:Any?]() nillableDictionary["ArrayArrayNumber"] = self.arrayArrayNumber?.encodeToJSON() + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/ArrayOfNumberOnly.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/ArrayOfNumberOnly.swift index 01ebd614c103..d8a77858c973 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/ArrayOfNumberOnly.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/ArrayOfNumberOnly.swift @@ -9,6 +9,7 @@ import Foundation open class ArrayOfNumberOnly: JSONEncodable { + public var arrayNumber: [Double]? public init() {} @@ -17,6 +18,7 @@ open class ArrayOfNumberOnly: JSONEncodable { open func encodeToJSON() -> Any { var nillableDictionary = [String:Any?]() nillableDictionary["ArrayNumber"] = self.arrayNumber?.encodeToJSON() + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/ArrayTest.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/ArrayTest.swift index e344f141f809..a46bb27cacba 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/ArrayTest.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/ArrayTest.swift @@ -9,6 +9,7 @@ import Foundation open class ArrayTest: JSONEncodable { + public var arrayOfString: [String]? public var arrayArrayOfInteger: [[Int64]]? public var arrayArrayOfModel: [[ReadOnlyFirst]]? @@ -21,6 +22,7 @@ open class ArrayTest: JSONEncodable { nillableDictionary["array_of_string"] = self.arrayOfString?.encodeToJSON() nillableDictionary["array_array_of_integer"] = self.arrayArrayOfInteger?.encodeToJSON() nillableDictionary["array_array_of_model"] = self.arrayArrayOfModel?.encodeToJSON() + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Capitalization.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Capitalization.swift index eee1085a69c3..54707831d7a8 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Capitalization.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Capitalization.swift @@ -9,6 +9,7 @@ import Foundation open class Capitalization: JSONEncodable { + public var smallCamel: String? public var capitalCamel: String? public var smallSnake: String? @@ -28,6 +29,7 @@ open class Capitalization: JSONEncodable { nillableDictionary["Capital_Snake"] = self.capitalSnake nillableDictionary["SCA_ETH_Flow_Points"] = self.sCAETHFlowPoints nillableDictionary["ATT_NAME"] = self.ATT_NAME + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Cat.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Cat.swift index 9c714f8e9fcd..6bfbfe267b51 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Cat.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Cat.swift @@ -9,6 +9,7 @@ import Foundation open class Cat: Animal { + public var declawed: Bool? @@ -17,6 +18,7 @@ open class Cat: Animal { override open func encodeToJSON() -> Any { var nillableDictionary = super.encodeToJSON() as? [String:Any?] ?? [String:Any?]() nillableDictionary["declawed"] = self.declawed + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Category.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Category.swift index 8f97c2b302bf..ed9bbc41ee08 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Category.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Category.swift @@ -9,6 +9,7 @@ import Foundation open class Category: JSONEncodable { + public var id: Int64? public var name: String? @@ -19,6 +20,7 @@ open class Category: JSONEncodable { var nillableDictionary = [String:Any?]() nillableDictionary["id"] = self.id?.encodeToJSON() nillableDictionary["name"] = self.name + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/ClassModel.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/ClassModel.swift index a34c950a19e8..33f610c373af 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/ClassModel.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/ClassModel.swift @@ -10,6 +10,7 @@ import Foundation /** Model for testing model with \"_class\" property */ open class ClassModel: JSONEncodable { + public var _class: String? public init() {} @@ -18,6 +19,7 @@ open class ClassModel: JSONEncodable { open func encodeToJSON() -> Any { var nillableDictionary = [String:Any?]() nillableDictionary["_class"] = self._class + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Client.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Client.swift index 9b2a4ab22047..adbe50b416da 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Client.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Client.swift @@ -9,6 +9,7 @@ import Foundation open class Client: JSONEncodable { + public var client: String? public init() {} @@ -17,6 +18,7 @@ open class Client: JSONEncodable { open func encodeToJSON() -> Any { var nillableDictionary = [String:Any?]() nillableDictionary["client"] = self.client + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Dog.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Dog.swift index 7ce0453b30ff..1df72ce1283d 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Dog.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Dog.swift @@ -9,6 +9,7 @@ import Foundation open class Dog: Animal { + public var breed: String? @@ -17,6 +18,7 @@ open class Dog: Animal { override open func encodeToJSON() -> Any { var nillableDictionary = super.encodeToJSON() as? [String:Any?] ?? [String:Any?]() nillableDictionary["breed"] = self.breed + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/EnumArrays.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/EnumArrays.swift index 1f40cde52f37..b54a5df9d767 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/EnumArrays.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/EnumArrays.swift @@ -9,6 +9,7 @@ import Foundation open class EnumArrays: JSONEncodable { + public enum JustSymbol: String { case greaterThanOrEqualTo = ">=" case dollar = "$" @@ -27,6 +28,7 @@ open class EnumArrays: JSONEncodable { var nillableDictionary = [String:Any?]() nillableDictionary["just_symbol"] = self.justSymbol?.rawValue nillableDictionary["array_enum"] = self.arrayEnum?.map({$0.rawValue}).encodeToJSON() + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/EnumTest.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/EnumTest.swift index 40f2f5d3aa88..4eb4f0f5842f 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/EnumTest.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/EnumTest.swift @@ -9,6 +9,7 @@ import Foundation open class EnumTest: JSONEncodable { + public enum EnumString: String { case upper = "UPPER" case lower = "lower" @@ -36,6 +37,7 @@ open class EnumTest: JSONEncodable { nillableDictionary["enum_integer"] = self.enumInteger?.rawValue nillableDictionary["enum_number"] = self.enumNumber?.rawValue nillableDictionary["outerEnum"] = self.outerEnum?.encodeToJSON() + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/FormatTest.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/FormatTest.swift index bdd5b678ba29..1a3b2ef11347 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/FormatTest.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/FormatTest.swift @@ -9,6 +9,7 @@ import Foundation open class FormatTest: JSONEncodable { + public var integer: Int32? public var int32: Int32? public var int64: Int64? @@ -41,6 +42,7 @@ open class FormatTest: JSONEncodable { nillableDictionary["dateTime"] = self.dateTime?.encodeToJSON() nillableDictionary["uuid"] = self.uuid?.encodeToJSON() nillableDictionary["password"] = self.password + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/HasOnlyReadOnly.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/HasOnlyReadOnly.swift index 4364dbaf776f..35de18afb7ab 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/HasOnlyReadOnly.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/HasOnlyReadOnly.swift @@ -9,6 +9,7 @@ import Foundation open class HasOnlyReadOnly: JSONEncodable { + public var bar: String? public var foo: String? @@ -19,6 +20,7 @@ open class HasOnlyReadOnly: JSONEncodable { var nillableDictionary = [String:Any?]() nillableDictionary["bar"] = self.bar nillableDictionary["foo"] = self.foo + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/List.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/List.swift index 7ce9ff47d4e4..03427b57091a 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/List.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/List.swift @@ -9,6 +9,7 @@ import Foundation open class List: JSONEncodable { + public var _123List: String? public init() {} @@ -17,6 +18,7 @@ open class List: JSONEncodable { open func encodeToJSON() -> Any { var nillableDictionary = [String:Any?]() nillableDictionary["123-list"] = self._123List + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/MapTest.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/MapTest.swift index 0880b687148d..d4fefbc417b9 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/MapTest.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/MapTest.swift @@ -9,6 +9,7 @@ import Foundation open class MapTest: JSONEncodable { + public enum MapOfEnumString: String { case upper = "UPPER" case lower = "lower" @@ -22,6 +23,7 @@ open class MapTest: JSONEncodable { open func encodeToJSON() -> Any { var nillableDictionary = [String:Any?]() nillableDictionary["map_map_of_string"] = self.mapMapOfString?.encodeToJSON()//TODO: handle enum map scenario + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/MixedPropertiesAndAdditionalPropertiesClass.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/MixedPropertiesAndAdditionalPropertiesClass.swift index a917131883ab..a738b2218e2b 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/MixedPropertiesAndAdditionalPropertiesClass.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/MixedPropertiesAndAdditionalPropertiesClass.swift @@ -9,6 +9,7 @@ import Foundation open class MixedPropertiesAndAdditionalPropertiesClass: JSONEncodable { + public var uuid: UUID? public var dateTime: Date? public var map: [String:Animal]? @@ -21,6 +22,7 @@ open class MixedPropertiesAndAdditionalPropertiesClass: JSONEncodable { nillableDictionary["uuid"] = self.uuid?.encodeToJSON() nillableDictionary["dateTime"] = self.dateTime?.encodeToJSON() nillableDictionary["map"] = self.map?.encodeToJSON() + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Model200Response.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Model200Response.swift index 3dcd6b09dc9e..d31ca62f3b11 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Model200Response.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Model200Response.swift @@ -10,6 +10,7 @@ import Foundation /** Model for testing model name starting with number */ open class Model200Response: JSONEncodable { + public var name: Int32? public var _class: String? @@ -20,6 +21,7 @@ open class Model200Response: JSONEncodable { var nillableDictionary = [String:Any?]() nillableDictionary["name"] = self.name?.encodeToJSON() nillableDictionary["class"] = self._class + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Name.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Name.swift index 9a271bdf8da4..50430f5f45ff 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Name.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Name.swift @@ -10,6 +10,7 @@ import Foundation /** Model for testing model name same as property name */ open class Name: JSONEncodable { + public var name: Int32? public var snakeCase: Int32? public var property: String? @@ -24,6 +25,7 @@ open class Name: JSONEncodable { nillableDictionary["snake_case"] = self.snakeCase?.encodeToJSON() nillableDictionary["property"] = self.property nillableDictionary["123Number"] = self._123Number?.encodeToJSON() + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/NumberOnly.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/NumberOnly.swift index f1e50d03ed12..842cc740daf1 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/NumberOnly.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/NumberOnly.swift @@ -9,6 +9,7 @@ import Foundation open class NumberOnly: JSONEncodable { + public var justNumber: Double? public init() {} @@ -17,6 +18,7 @@ open class NumberOnly: JSONEncodable { open func encodeToJSON() -> Any { var nillableDictionary = [String:Any?]() nillableDictionary["JustNumber"] = self.justNumber + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Order.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Order.swift index 3eb64b90959f..3d43e79c92b8 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Order.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Order.swift @@ -9,6 +9,7 @@ import Foundation open class Order: JSONEncodable { + public enum Status: String { case placed = "placed" case approved = "approved" @@ -33,6 +34,7 @@ open class Order: JSONEncodable { nillableDictionary["shipDate"] = self.shipDate?.encodeToJSON() nillableDictionary["status"] = self.status?.rawValue nillableDictionary["complete"] = self.complete + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Pet.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Pet.swift index 08d61de5ab47..0492ac800f3d 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Pet.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Pet.swift @@ -9,6 +9,7 @@ import Foundation open class Pet: JSONEncodable { + public enum Status: String { case available = "available" case pending = "pending" @@ -33,6 +34,7 @@ open class Pet: JSONEncodable { nillableDictionary["photoUrls"] = self.photoUrls?.encodeToJSON() nillableDictionary["tags"] = self.tags?.encodeToJSON() nillableDictionary["status"] = self.status?.rawValue + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/ReadOnlyFirst.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/ReadOnlyFirst.swift index 00cabfb0859e..91d93e166b19 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/ReadOnlyFirst.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/ReadOnlyFirst.swift @@ -9,6 +9,7 @@ import Foundation open class ReadOnlyFirst: JSONEncodable { + public var bar: String? public var baz: String? @@ -19,6 +20,7 @@ open class ReadOnlyFirst: JSONEncodable { var nillableDictionary = [String:Any?]() nillableDictionary["bar"] = self.bar nillableDictionary["baz"] = self.baz + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Return.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Return.swift index f7e490008bc4..dcffb177a6ad 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Return.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Return.swift @@ -10,6 +10,7 @@ import Foundation /** Model for testing reserved words */ open class Return: JSONEncodable { + public var _return: Int32? public init() {} @@ -18,6 +19,7 @@ open class Return: JSONEncodable { open func encodeToJSON() -> Any { var nillableDictionary = [String:Any?]() nillableDictionary["return"] = self._return?.encodeToJSON() + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/SpecialModelName.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/SpecialModelName.swift index 9c84a306acbf..86317fcc6f2d 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/SpecialModelName.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/SpecialModelName.swift @@ -9,6 +9,7 @@ import Foundation open class SpecialModelName: JSONEncodable { + public var specialPropertyName: Int64? public init() {} @@ -17,6 +18,7 @@ open class SpecialModelName: JSONEncodable { open func encodeToJSON() -> Any { var nillableDictionary = [String:Any?]() nillableDictionary["$special[property.name]"] = self.specialPropertyName?.encodeToJSON() + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Tag.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Tag.swift index e175e5aac350..a66bc4b484fb 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Tag.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Tag.swift @@ -9,6 +9,7 @@ import Foundation open class Tag: JSONEncodable { + public var id: Int64? public var name: String? @@ -19,6 +20,7 @@ open class Tag: JSONEncodable { var nillableDictionary = [String:Any?]() nillableDictionary["id"] = self.id?.encodeToJSON() nillableDictionary["name"] = self.name + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/User.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/User.swift index c3887ebffc6f..ae54b81e80f3 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/User.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/User.swift @@ -9,6 +9,7 @@ import Foundation open class User: JSONEncodable { + public var id: Int64? public var username: String? public var firstName: String? @@ -32,6 +33,7 @@ open class User: JSONEncodable { nillableDictionary["password"] = self.password nillableDictionary["phone"] = self.phone nillableDictionary["userStatus"] = self.userStatus?.encodeToJSON() + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models.swift b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models.swift index a25903a430f9..930bf97ff07d 100644 --- a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models.swift +++ b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models.swift @@ -257,7 +257,6 @@ class Decoders { // Decoder for AdditionalPropertiesClass Decoders.addDecoder(clazz: AdditionalPropertiesClass.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? AdditionalPropertiesClass() : instance as! AdditionalPropertiesClass switch Decoders.decodeOptional(clazz: [String:String].self, source: sourceDictionary["map_property"] as AnyObject?) { @@ -288,7 +287,6 @@ class Decoders { if let discriminator = sourceDictionary["className"] as? String, instance == nil && discriminator != "Animal"{ return Decoders.decode(clazz: Animal.self, discriminator: discriminator, source: source) } - let result = instance == nil ? Animal() : instance as! Animal switch Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["className"] as AnyObject?) { @@ -318,7 +316,6 @@ class Decoders { // Decoder for ApiResponse Decoders.addDecoder(clazz: ApiResponse.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? ApiResponse() : instance as! ApiResponse switch Decoders.decodeOptional(clazz: Int32.self, source: sourceDictionary["code"] as AnyObject?) { @@ -351,7 +348,6 @@ class Decoders { // Decoder for ArrayOfArrayOfNumberOnly Decoders.addDecoder(clazz: ArrayOfArrayOfNumberOnly.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? ArrayOfArrayOfNumberOnly() : instance as! ArrayOfArrayOfNumberOnly switch Decoders.decodeOptional(clazz: [[Double]].self, source: sourceDictionary["ArrayArrayNumber"] as AnyObject?) { @@ -372,7 +368,6 @@ class Decoders { // Decoder for ArrayOfNumberOnly Decoders.addDecoder(clazz: ArrayOfNumberOnly.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? ArrayOfNumberOnly() : instance as! ArrayOfNumberOnly switch Decoders.decodeOptional(clazz: [Double].self, source: sourceDictionary["ArrayNumber"] as AnyObject?) { @@ -393,7 +388,6 @@ class Decoders { // Decoder for ArrayTest Decoders.addDecoder(clazz: ArrayTest.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? ArrayTest() : instance as! ArrayTest switch Decoders.decodeOptional(clazz: [String].self, source: sourceDictionary["array_of_string"] as AnyObject?) { @@ -426,7 +420,6 @@ class Decoders { // Decoder for Capitalization Decoders.addDecoder(clazz: Capitalization.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? Capitalization() : instance as! Capitalization switch Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["smallCamel"] as AnyObject?) { @@ -477,7 +470,6 @@ class Decoders { // Decoder for Cat Decoders.addDecoder(clazz: Cat.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? Cat() : instance as! Cat if decoders["\(Animal.self)"] != nil { _ = Decoders.decode(clazz: Animal.self, source: source, instance: result) @@ -513,7 +505,6 @@ class Decoders { // Decoder for Category Decoders.addDecoder(clazz: Category.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? Category() : instance as! Category switch Decoders.decodeOptional(clazz: Int64.self, source: sourceDictionary["id"] as AnyObject?) { @@ -540,7 +531,6 @@ class Decoders { // Decoder for ClassModel Decoders.addDecoder(clazz: ClassModel.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? ClassModel() : instance as! ClassModel switch Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["_class"] as AnyObject?) { @@ -561,7 +551,6 @@ class Decoders { // Decoder for Client Decoders.addDecoder(clazz: Client.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? Client() : instance as! Client switch Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["client"] as AnyObject?) { @@ -582,7 +571,6 @@ class Decoders { // Decoder for Dog Decoders.addDecoder(clazz: Dog.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? Dog() : instance as! Dog if decoders["\(Animal.self)"] != nil { _ = Decoders.decode(clazz: Animal.self, source: source, instance: result) @@ -618,7 +606,6 @@ class Decoders { // Decoder for EnumArrays Decoders.addDecoder(clazz: EnumArrays.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? EnumArrays() : instance as! EnumArrays switch Decoders.decodeOptional(clazz: EnumArrays.JustSymbol.self, source: sourceDictionary["just_symbol"] as AnyObject?) { @@ -655,7 +642,6 @@ class Decoders { // Decoder for EnumTest Decoders.addDecoder(clazz: EnumTest.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? EnumTest() : instance as! EnumTest switch Decoders.decodeOptional(clazz: EnumTest.EnumString.self, source: sourceDictionary["enum_string"] as AnyObject?) { @@ -694,7 +680,6 @@ class Decoders { // Decoder for FormatTest Decoders.addDecoder(clazz: FormatTest.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? FormatTest() : instance as! FormatTest switch Decoders.decodeOptional(clazz: Int32.self, source: sourceDictionary["integer"] as AnyObject?) { @@ -787,7 +772,6 @@ class Decoders { // Decoder for HasOnlyReadOnly Decoders.addDecoder(clazz: HasOnlyReadOnly.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? HasOnlyReadOnly() : instance as! HasOnlyReadOnly switch Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["bar"] as AnyObject?) { @@ -814,7 +798,6 @@ class Decoders { // Decoder for List Decoders.addDecoder(clazz: List.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? List() : instance as! List switch Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["123-list"] as AnyObject?) { @@ -835,7 +818,6 @@ class Decoders { // Decoder for MapTest Decoders.addDecoder(clazz: MapTest.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? MapTest() : instance as! MapTest switch Decoders.decodeOptional(clazz: [String:[String:String]].self, source: sourceDictionary["map_map_of_string"] as AnyObject?) { @@ -862,7 +844,6 @@ class Decoders { // Decoder for MixedPropertiesAndAdditionalPropertiesClass Decoders.addDecoder(clazz: MixedPropertiesAndAdditionalPropertiesClass.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? MixedPropertiesAndAdditionalPropertiesClass() : instance as! MixedPropertiesAndAdditionalPropertiesClass switch Decoders.decodeOptional(clazz: UUID.self, source: sourceDictionary["uuid"] as AnyObject?) { @@ -895,7 +876,6 @@ class Decoders { // Decoder for Model200Response Decoders.addDecoder(clazz: Model200Response.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? Model200Response() : instance as! Model200Response switch Decoders.decodeOptional(clazz: Int32.self, source: sourceDictionary["name"] as AnyObject?) { @@ -922,7 +902,6 @@ class Decoders { // Decoder for Name Decoders.addDecoder(clazz: Name.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? Name() : instance as! Name switch Decoders.decodeOptional(clazz: Int32.self, source: sourceDictionary["name"] as AnyObject?) { @@ -961,7 +940,6 @@ class Decoders { // Decoder for NumberOnly Decoders.addDecoder(clazz: NumberOnly.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? NumberOnly() : instance as! NumberOnly switch Decoders.decodeOptional(clazz: Double.self, source: sourceDictionary["JustNumber"] as AnyObject?) { @@ -982,7 +960,6 @@ class Decoders { // Decoder for Order Decoders.addDecoder(clazz: Order.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? Order() : instance as! Order switch Decoders.decodeOptional(clazz: Int64.self, source: sourceDictionary["id"] as AnyObject?) { @@ -1043,7 +1020,6 @@ class Decoders { // Decoder for Pet Decoders.addDecoder(clazz: Pet.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? Pet() : instance as! Pet switch Decoders.decodeOptional(clazz: Int64.self, source: sourceDictionary["id"] as AnyObject?) { @@ -1094,7 +1070,6 @@ class Decoders { // Decoder for ReadOnlyFirst Decoders.addDecoder(clazz: ReadOnlyFirst.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? ReadOnlyFirst() : instance as! ReadOnlyFirst switch Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["bar"] as AnyObject?) { @@ -1121,7 +1096,6 @@ class Decoders { // Decoder for Return Decoders.addDecoder(clazz: Return.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? Return() : instance as! Return switch Decoders.decodeOptional(clazz: Int32.self, source: sourceDictionary["return"] as AnyObject?) { @@ -1142,7 +1116,6 @@ class Decoders { // Decoder for SpecialModelName Decoders.addDecoder(clazz: SpecialModelName.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? SpecialModelName() : instance as! SpecialModelName switch Decoders.decodeOptional(clazz: Int64.self, source: sourceDictionary["$special[property.name]"] as AnyObject?) { @@ -1163,7 +1136,6 @@ class Decoders { // Decoder for Tag Decoders.addDecoder(clazz: Tag.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? Tag() : instance as! Tag switch Decoders.decodeOptional(clazz: Int64.self, source: sourceDictionary["id"] as AnyObject?) { @@ -1190,7 +1162,6 @@ class Decoders { // Decoder for User Decoders.addDecoder(clazz: User.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? User() : instance as! User switch Decoders.decodeOptional(clazz: Int64.self, source: sourceDictionary["id"] as AnyObject?) { diff --git a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/AdditionalPropertiesClass.swift b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/AdditionalPropertiesClass.swift index 1d597c725421..841becdb238b 100644 --- a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/AdditionalPropertiesClass.swift +++ b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/AdditionalPropertiesClass.swift @@ -9,6 +9,7 @@ import Foundation open class AdditionalPropertiesClass: JSONEncodable { + public var mapProperty: [String:String]? public var mapOfMapProperty: [String:[String:String]]? @@ -19,6 +20,7 @@ open class AdditionalPropertiesClass: JSONEncodable { var nillableDictionary = [String:Any?]() nillableDictionary["map_property"] = self.mapProperty?.encodeToJSON() nillableDictionary["map_of_map_property"] = self.mapOfMapProperty?.encodeToJSON() + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/Animal.swift b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/Animal.swift index bcb5136be44a..057ab8e803e4 100644 --- a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/Animal.swift +++ b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/Animal.swift @@ -9,6 +9,7 @@ import Foundation open class Animal: JSONEncodable { + public var className: String? public var color: String? @@ -19,6 +20,7 @@ open class Animal: JSONEncodable { var nillableDictionary = [String:Any?]() nillableDictionary["className"] = self.className nillableDictionary["color"] = self.color + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/ApiResponse.swift b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/ApiResponse.swift index 20aaed5294cd..c95f95c7afaa 100644 --- a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/ApiResponse.swift +++ b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/ApiResponse.swift @@ -9,6 +9,7 @@ import Foundation open class ApiResponse: JSONEncodable { + public var code: Int32? public var type: String? public var message: String? @@ -21,6 +22,7 @@ open class ApiResponse: JSONEncodable { nillableDictionary["code"] = self.code?.encodeToJSON() nillableDictionary["type"] = self.type nillableDictionary["message"] = self.message + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/ArrayOfArrayOfNumberOnly.swift b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/ArrayOfArrayOfNumberOnly.swift index 6a549ca866b5..f10815e48289 100644 --- a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/ArrayOfArrayOfNumberOnly.swift +++ b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/ArrayOfArrayOfNumberOnly.swift @@ -9,6 +9,7 @@ import Foundation open class ArrayOfArrayOfNumberOnly: JSONEncodable { + public var arrayArrayNumber: [[Double]]? public init() {} @@ -17,6 +18,7 @@ open class ArrayOfArrayOfNumberOnly: JSONEncodable { open func encodeToJSON() -> Any { var nillableDictionary = [String:Any?]() nillableDictionary["ArrayArrayNumber"] = self.arrayArrayNumber?.encodeToJSON() + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/ArrayOfNumberOnly.swift b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/ArrayOfNumberOnly.swift index 01ebd614c103..d8a77858c973 100644 --- a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/ArrayOfNumberOnly.swift +++ b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/ArrayOfNumberOnly.swift @@ -9,6 +9,7 @@ import Foundation open class ArrayOfNumberOnly: JSONEncodable { + public var arrayNumber: [Double]? public init() {} @@ -17,6 +18,7 @@ open class ArrayOfNumberOnly: JSONEncodable { open func encodeToJSON() -> Any { var nillableDictionary = [String:Any?]() nillableDictionary["ArrayNumber"] = self.arrayNumber?.encodeToJSON() + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/ArrayTest.swift b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/ArrayTest.swift index e344f141f809..a46bb27cacba 100644 --- a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/ArrayTest.swift +++ b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/ArrayTest.swift @@ -9,6 +9,7 @@ import Foundation open class ArrayTest: JSONEncodable { + public var arrayOfString: [String]? public var arrayArrayOfInteger: [[Int64]]? public var arrayArrayOfModel: [[ReadOnlyFirst]]? @@ -21,6 +22,7 @@ open class ArrayTest: JSONEncodable { nillableDictionary["array_of_string"] = self.arrayOfString?.encodeToJSON() nillableDictionary["array_array_of_integer"] = self.arrayArrayOfInteger?.encodeToJSON() nillableDictionary["array_array_of_model"] = self.arrayArrayOfModel?.encodeToJSON() + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/Capitalization.swift b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/Capitalization.swift index eee1085a69c3..54707831d7a8 100644 --- a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/Capitalization.swift +++ b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/Capitalization.swift @@ -9,6 +9,7 @@ import Foundation open class Capitalization: JSONEncodable { + public var smallCamel: String? public var capitalCamel: String? public var smallSnake: String? @@ -28,6 +29,7 @@ open class Capitalization: JSONEncodable { nillableDictionary["Capital_Snake"] = self.capitalSnake nillableDictionary["SCA_ETH_Flow_Points"] = self.sCAETHFlowPoints nillableDictionary["ATT_NAME"] = self.ATT_NAME + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/Cat.swift b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/Cat.swift index 9c714f8e9fcd..6bfbfe267b51 100644 --- a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/Cat.swift +++ b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/Cat.swift @@ -9,6 +9,7 @@ import Foundation open class Cat: Animal { + public var declawed: Bool? @@ -17,6 +18,7 @@ open class Cat: Animal { override open func encodeToJSON() -> Any { var nillableDictionary = super.encodeToJSON() as? [String:Any?] ?? [String:Any?]() nillableDictionary["declawed"] = self.declawed + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/Category.swift b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/Category.swift index 8f97c2b302bf..ed9bbc41ee08 100644 --- a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/Category.swift +++ b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/Category.swift @@ -9,6 +9,7 @@ import Foundation open class Category: JSONEncodable { + public var id: Int64? public var name: String? @@ -19,6 +20,7 @@ open class Category: JSONEncodable { var nillableDictionary = [String:Any?]() nillableDictionary["id"] = self.id?.encodeToJSON() nillableDictionary["name"] = self.name + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/ClassModel.swift b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/ClassModel.swift index a34c950a19e8..33f610c373af 100644 --- a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/ClassModel.swift +++ b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/ClassModel.swift @@ -10,6 +10,7 @@ import Foundation /** Model for testing model with \"_class\" property */ open class ClassModel: JSONEncodable { + public var _class: String? public init() {} @@ -18,6 +19,7 @@ open class ClassModel: JSONEncodable { open func encodeToJSON() -> Any { var nillableDictionary = [String:Any?]() nillableDictionary["_class"] = self._class + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/Client.swift b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/Client.swift index 9b2a4ab22047..adbe50b416da 100644 --- a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/Client.swift +++ b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/Client.swift @@ -9,6 +9,7 @@ import Foundation open class Client: JSONEncodable { + public var client: String? public init() {} @@ -17,6 +18,7 @@ open class Client: JSONEncodable { open func encodeToJSON() -> Any { var nillableDictionary = [String:Any?]() nillableDictionary["client"] = self.client + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/Dog.swift b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/Dog.swift index 7ce0453b30ff..1df72ce1283d 100644 --- a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/Dog.swift +++ b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/Dog.swift @@ -9,6 +9,7 @@ import Foundation open class Dog: Animal { + public var breed: String? @@ -17,6 +18,7 @@ open class Dog: Animal { override open func encodeToJSON() -> Any { var nillableDictionary = super.encodeToJSON() as? [String:Any?] ?? [String:Any?]() nillableDictionary["breed"] = self.breed + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/EnumArrays.swift b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/EnumArrays.swift index 1f40cde52f37..b54a5df9d767 100644 --- a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/EnumArrays.swift +++ b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/EnumArrays.swift @@ -9,6 +9,7 @@ import Foundation open class EnumArrays: JSONEncodable { + public enum JustSymbol: String { case greaterThanOrEqualTo = ">=" case dollar = "$" @@ -27,6 +28,7 @@ open class EnumArrays: JSONEncodable { var nillableDictionary = [String:Any?]() nillableDictionary["just_symbol"] = self.justSymbol?.rawValue nillableDictionary["array_enum"] = self.arrayEnum?.map({$0.rawValue}).encodeToJSON() + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/EnumTest.swift b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/EnumTest.swift index 40f2f5d3aa88..4eb4f0f5842f 100644 --- a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/EnumTest.swift +++ b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/EnumTest.swift @@ -9,6 +9,7 @@ import Foundation open class EnumTest: JSONEncodable { + public enum EnumString: String { case upper = "UPPER" case lower = "lower" @@ -36,6 +37,7 @@ open class EnumTest: JSONEncodable { nillableDictionary["enum_integer"] = self.enumInteger?.rawValue nillableDictionary["enum_number"] = self.enumNumber?.rawValue nillableDictionary["outerEnum"] = self.outerEnum?.encodeToJSON() + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/FormatTest.swift b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/FormatTest.swift index bdd5b678ba29..1a3b2ef11347 100644 --- a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/FormatTest.swift +++ b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/FormatTest.swift @@ -9,6 +9,7 @@ import Foundation open class FormatTest: JSONEncodable { + public var integer: Int32? public var int32: Int32? public var int64: Int64? @@ -41,6 +42,7 @@ open class FormatTest: JSONEncodable { nillableDictionary["dateTime"] = self.dateTime?.encodeToJSON() nillableDictionary["uuid"] = self.uuid?.encodeToJSON() nillableDictionary["password"] = self.password + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/HasOnlyReadOnly.swift b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/HasOnlyReadOnly.swift index 4364dbaf776f..35de18afb7ab 100644 --- a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/HasOnlyReadOnly.swift +++ b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/HasOnlyReadOnly.swift @@ -9,6 +9,7 @@ import Foundation open class HasOnlyReadOnly: JSONEncodable { + public var bar: String? public var foo: String? @@ -19,6 +20,7 @@ open class HasOnlyReadOnly: JSONEncodable { var nillableDictionary = [String:Any?]() nillableDictionary["bar"] = self.bar nillableDictionary["foo"] = self.foo + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/List.swift b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/List.swift index 7ce9ff47d4e4..03427b57091a 100644 --- a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/List.swift +++ b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/List.swift @@ -9,6 +9,7 @@ import Foundation open class List: JSONEncodable { + public var _123List: String? public init() {} @@ -17,6 +18,7 @@ open class List: JSONEncodable { open func encodeToJSON() -> Any { var nillableDictionary = [String:Any?]() nillableDictionary["123-list"] = self._123List + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/MapTest.swift b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/MapTest.swift index 0880b687148d..d4fefbc417b9 100644 --- a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/MapTest.swift +++ b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/MapTest.swift @@ -9,6 +9,7 @@ import Foundation open class MapTest: JSONEncodable { + public enum MapOfEnumString: String { case upper = "UPPER" case lower = "lower" @@ -22,6 +23,7 @@ open class MapTest: JSONEncodable { open func encodeToJSON() -> Any { var nillableDictionary = [String:Any?]() nillableDictionary["map_map_of_string"] = self.mapMapOfString?.encodeToJSON()//TODO: handle enum map scenario + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/MixedPropertiesAndAdditionalPropertiesClass.swift b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/MixedPropertiesAndAdditionalPropertiesClass.swift index a917131883ab..a738b2218e2b 100644 --- a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/MixedPropertiesAndAdditionalPropertiesClass.swift +++ b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/MixedPropertiesAndAdditionalPropertiesClass.swift @@ -9,6 +9,7 @@ import Foundation open class MixedPropertiesAndAdditionalPropertiesClass: JSONEncodable { + public var uuid: UUID? public var dateTime: Date? public var map: [String:Animal]? @@ -21,6 +22,7 @@ open class MixedPropertiesAndAdditionalPropertiesClass: JSONEncodable { nillableDictionary["uuid"] = self.uuid?.encodeToJSON() nillableDictionary["dateTime"] = self.dateTime?.encodeToJSON() nillableDictionary["map"] = self.map?.encodeToJSON() + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/Model200Response.swift b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/Model200Response.swift index 3dcd6b09dc9e..d31ca62f3b11 100644 --- a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/Model200Response.swift +++ b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/Model200Response.swift @@ -10,6 +10,7 @@ import Foundation /** Model for testing model name starting with number */ open class Model200Response: JSONEncodable { + public var name: Int32? public var _class: String? @@ -20,6 +21,7 @@ open class Model200Response: JSONEncodable { var nillableDictionary = [String:Any?]() nillableDictionary["name"] = self.name?.encodeToJSON() nillableDictionary["class"] = self._class + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/Name.swift b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/Name.swift index 9a271bdf8da4..50430f5f45ff 100644 --- a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/Name.swift +++ b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/Name.swift @@ -10,6 +10,7 @@ import Foundation /** Model for testing model name same as property name */ open class Name: JSONEncodable { + public var name: Int32? public var snakeCase: Int32? public var property: String? @@ -24,6 +25,7 @@ open class Name: JSONEncodable { nillableDictionary["snake_case"] = self.snakeCase?.encodeToJSON() nillableDictionary["property"] = self.property nillableDictionary["123Number"] = self._123Number?.encodeToJSON() + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/NumberOnly.swift b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/NumberOnly.swift index f1e50d03ed12..842cc740daf1 100644 --- a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/NumberOnly.swift +++ b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/NumberOnly.swift @@ -9,6 +9,7 @@ import Foundation open class NumberOnly: JSONEncodable { + public var justNumber: Double? public init() {} @@ -17,6 +18,7 @@ open class NumberOnly: JSONEncodable { open func encodeToJSON() -> Any { var nillableDictionary = [String:Any?]() nillableDictionary["JustNumber"] = self.justNumber + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/Order.swift b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/Order.swift index 3eb64b90959f..3d43e79c92b8 100644 --- a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/Order.swift +++ b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/Order.swift @@ -9,6 +9,7 @@ import Foundation open class Order: JSONEncodable { + public enum Status: String { case placed = "placed" case approved = "approved" @@ -33,6 +34,7 @@ open class Order: JSONEncodable { nillableDictionary["shipDate"] = self.shipDate?.encodeToJSON() nillableDictionary["status"] = self.status?.rawValue nillableDictionary["complete"] = self.complete + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/Pet.swift b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/Pet.swift index 08d61de5ab47..0492ac800f3d 100644 --- a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/Pet.swift +++ b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/Pet.swift @@ -9,6 +9,7 @@ import Foundation open class Pet: JSONEncodable { + public enum Status: String { case available = "available" case pending = "pending" @@ -33,6 +34,7 @@ open class Pet: JSONEncodable { nillableDictionary["photoUrls"] = self.photoUrls?.encodeToJSON() nillableDictionary["tags"] = self.tags?.encodeToJSON() nillableDictionary["status"] = self.status?.rawValue + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/ReadOnlyFirst.swift b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/ReadOnlyFirst.swift index 00cabfb0859e..91d93e166b19 100644 --- a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/ReadOnlyFirst.swift +++ b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/ReadOnlyFirst.swift @@ -9,6 +9,7 @@ import Foundation open class ReadOnlyFirst: JSONEncodable { + public var bar: String? public var baz: String? @@ -19,6 +20,7 @@ open class ReadOnlyFirst: JSONEncodable { var nillableDictionary = [String:Any?]() nillableDictionary["bar"] = self.bar nillableDictionary["baz"] = self.baz + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/Return.swift b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/Return.swift index f7e490008bc4..dcffb177a6ad 100644 --- a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/Return.swift +++ b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/Return.swift @@ -10,6 +10,7 @@ import Foundation /** Model for testing reserved words */ open class Return: JSONEncodable { + public var _return: Int32? public init() {} @@ -18,6 +19,7 @@ open class Return: JSONEncodable { open func encodeToJSON() -> Any { var nillableDictionary = [String:Any?]() nillableDictionary["return"] = self._return?.encodeToJSON() + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/SpecialModelName.swift b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/SpecialModelName.swift index 9c84a306acbf..86317fcc6f2d 100644 --- a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/SpecialModelName.swift +++ b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/SpecialModelName.swift @@ -9,6 +9,7 @@ import Foundation open class SpecialModelName: JSONEncodable { + public var specialPropertyName: Int64? public init() {} @@ -17,6 +18,7 @@ open class SpecialModelName: JSONEncodable { open func encodeToJSON() -> Any { var nillableDictionary = [String:Any?]() nillableDictionary["$special[property.name]"] = self.specialPropertyName?.encodeToJSON() + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/Tag.swift b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/Tag.swift index e175e5aac350..a66bc4b484fb 100644 --- a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/Tag.swift +++ b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/Tag.swift @@ -9,6 +9,7 @@ import Foundation open class Tag: JSONEncodable { + public var id: Int64? public var name: String? @@ -19,6 +20,7 @@ open class Tag: JSONEncodable { var nillableDictionary = [String:Any?]() nillableDictionary["id"] = self.id?.encodeToJSON() nillableDictionary["name"] = self.name + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/User.swift b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/User.swift index c3887ebffc6f..ae54b81e80f3 100644 --- a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/User.swift +++ b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/User.swift @@ -9,6 +9,7 @@ import Foundation open class User: JSONEncodable { + public var id: Int64? public var username: String? public var firstName: String? @@ -32,6 +33,7 @@ open class User: JSONEncodable { nillableDictionary["password"] = self.password nillableDictionary["phone"] = self.phone nillableDictionary["userStatus"] = self.userStatus?.encodeToJSON() + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models.swift b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models.swift index a25903a430f9..930bf97ff07d 100644 --- a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models.swift +++ b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models.swift @@ -257,7 +257,6 @@ class Decoders { // Decoder for AdditionalPropertiesClass Decoders.addDecoder(clazz: AdditionalPropertiesClass.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? AdditionalPropertiesClass() : instance as! AdditionalPropertiesClass switch Decoders.decodeOptional(clazz: [String:String].self, source: sourceDictionary["map_property"] as AnyObject?) { @@ -288,7 +287,6 @@ class Decoders { if let discriminator = sourceDictionary["className"] as? String, instance == nil && discriminator != "Animal"{ return Decoders.decode(clazz: Animal.self, discriminator: discriminator, source: source) } - let result = instance == nil ? Animal() : instance as! Animal switch Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["className"] as AnyObject?) { @@ -318,7 +316,6 @@ class Decoders { // Decoder for ApiResponse Decoders.addDecoder(clazz: ApiResponse.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? ApiResponse() : instance as! ApiResponse switch Decoders.decodeOptional(clazz: Int32.self, source: sourceDictionary["code"] as AnyObject?) { @@ -351,7 +348,6 @@ class Decoders { // Decoder for ArrayOfArrayOfNumberOnly Decoders.addDecoder(clazz: ArrayOfArrayOfNumberOnly.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? ArrayOfArrayOfNumberOnly() : instance as! ArrayOfArrayOfNumberOnly switch Decoders.decodeOptional(clazz: [[Double]].self, source: sourceDictionary["ArrayArrayNumber"] as AnyObject?) { @@ -372,7 +368,6 @@ class Decoders { // Decoder for ArrayOfNumberOnly Decoders.addDecoder(clazz: ArrayOfNumberOnly.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? ArrayOfNumberOnly() : instance as! ArrayOfNumberOnly switch Decoders.decodeOptional(clazz: [Double].self, source: sourceDictionary["ArrayNumber"] as AnyObject?) { @@ -393,7 +388,6 @@ class Decoders { // Decoder for ArrayTest Decoders.addDecoder(clazz: ArrayTest.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? ArrayTest() : instance as! ArrayTest switch Decoders.decodeOptional(clazz: [String].self, source: sourceDictionary["array_of_string"] as AnyObject?) { @@ -426,7 +420,6 @@ class Decoders { // Decoder for Capitalization Decoders.addDecoder(clazz: Capitalization.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? Capitalization() : instance as! Capitalization switch Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["smallCamel"] as AnyObject?) { @@ -477,7 +470,6 @@ class Decoders { // Decoder for Cat Decoders.addDecoder(clazz: Cat.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? Cat() : instance as! Cat if decoders["\(Animal.self)"] != nil { _ = Decoders.decode(clazz: Animal.self, source: source, instance: result) @@ -513,7 +505,6 @@ class Decoders { // Decoder for Category Decoders.addDecoder(clazz: Category.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? Category() : instance as! Category switch Decoders.decodeOptional(clazz: Int64.self, source: sourceDictionary["id"] as AnyObject?) { @@ -540,7 +531,6 @@ class Decoders { // Decoder for ClassModel Decoders.addDecoder(clazz: ClassModel.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? ClassModel() : instance as! ClassModel switch Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["_class"] as AnyObject?) { @@ -561,7 +551,6 @@ class Decoders { // Decoder for Client Decoders.addDecoder(clazz: Client.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? Client() : instance as! Client switch Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["client"] as AnyObject?) { @@ -582,7 +571,6 @@ class Decoders { // Decoder for Dog Decoders.addDecoder(clazz: Dog.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? Dog() : instance as! Dog if decoders["\(Animal.self)"] != nil { _ = Decoders.decode(clazz: Animal.self, source: source, instance: result) @@ -618,7 +606,6 @@ class Decoders { // Decoder for EnumArrays Decoders.addDecoder(clazz: EnumArrays.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? EnumArrays() : instance as! EnumArrays switch Decoders.decodeOptional(clazz: EnumArrays.JustSymbol.self, source: sourceDictionary["just_symbol"] as AnyObject?) { @@ -655,7 +642,6 @@ class Decoders { // Decoder for EnumTest Decoders.addDecoder(clazz: EnumTest.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? EnumTest() : instance as! EnumTest switch Decoders.decodeOptional(clazz: EnumTest.EnumString.self, source: sourceDictionary["enum_string"] as AnyObject?) { @@ -694,7 +680,6 @@ class Decoders { // Decoder for FormatTest Decoders.addDecoder(clazz: FormatTest.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? FormatTest() : instance as! FormatTest switch Decoders.decodeOptional(clazz: Int32.self, source: sourceDictionary["integer"] as AnyObject?) { @@ -787,7 +772,6 @@ class Decoders { // Decoder for HasOnlyReadOnly Decoders.addDecoder(clazz: HasOnlyReadOnly.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? HasOnlyReadOnly() : instance as! HasOnlyReadOnly switch Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["bar"] as AnyObject?) { @@ -814,7 +798,6 @@ class Decoders { // Decoder for List Decoders.addDecoder(clazz: List.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? List() : instance as! List switch Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["123-list"] as AnyObject?) { @@ -835,7 +818,6 @@ class Decoders { // Decoder for MapTest Decoders.addDecoder(clazz: MapTest.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? MapTest() : instance as! MapTest switch Decoders.decodeOptional(clazz: [String:[String:String]].self, source: sourceDictionary["map_map_of_string"] as AnyObject?) { @@ -862,7 +844,6 @@ class Decoders { // Decoder for MixedPropertiesAndAdditionalPropertiesClass Decoders.addDecoder(clazz: MixedPropertiesAndAdditionalPropertiesClass.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? MixedPropertiesAndAdditionalPropertiesClass() : instance as! MixedPropertiesAndAdditionalPropertiesClass switch Decoders.decodeOptional(clazz: UUID.self, source: sourceDictionary["uuid"] as AnyObject?) { @@ -895,7 +876,6 @@ class Decoders { // Decoder for Model200Response Decoders.addDecoder(clazz: Model200Response.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? Model200Response() : instance as! Model200Response switch Decoders.decodeOptional(clazz: Int32.self, source: sourceDictionary["name"] as AnyObject?) { @@ -922,7 +902,6 @@ class Decoders { // Decoder for Name Decoders.addDecoder(clazz: Name.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? Name() : instance as! Name switch Decoders.decodeOptional(clazz: Int32.self, source: sourceDictionary["name"] as AnyObject?) { @@ -961,7 +940,6 @@ class Decoders { // Decoder for NumberOnly Decoders.addDecoder(clazz: NumberOnly.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? NumberOnly() : instance as! NumberOnly switch Decoders.decodeOptional(clazz: Double.self, source: sourceDictionary["JustNumber"] as AnyObject?) { @@ -982,7 +960,6 @@ class Decoders { // Decoder for Order Decoders.addDecoder(clazz: Order.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? Order() : instance as! Order switch Decoders.decodeOptional(clazz: Int64.self, source: sourceDictionary["id"] as AnyObject?) { @@ -1043,7 +1020,6 @@ class Decoders { // Decoder for Pet Decoders.addDecoder(clazz: Pet.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? Pet() : instance as! Pet switch Decoders.decodeOptional(clazz: Int64.self, source: sourceDictionary["id"] as AnyObject?) { @@ -1094,7 +1070,6 @@ class Decoders { // Decoder for ReadOnlyFirst Decoders.addDecoder(clazz: ReadOnlyFirst.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? ReadOnlyFirst() : instance as! ReadOnlyFirst switch Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["bar"] as AnyObject?) { @@ -1121,7 +1096,6 @@ class Decoders { // Decoder for Return Decoders.addDecoder(clazz: Return.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? Return() : instance as! Return switch Decoders.decodeOptional(clazz: Int32.self, source: sourceDictionary["return"] as AnyObject?) { @@ -1142,7 +1116,6 @@ class Decoders { // Decoder for SpecialModelName Decoders.addDecoder(clazz: SpecialModelName.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? SpecialModelName() : instance as! SpecialModelName switch Decoders.decodeOptional(clazz: Int64.self, source: sourceDictionary["$special[property.name]"] as AnyObject?) { @@ -1163,7 +1136,6 @@ class Decoders { // Decoder for Tag Decoders.addDecoder(clazz: Tag.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? Tag() : instance as! Tag switch Decoders.decodeOptional(clazz: Int64.self, source: sourceDictionary["id"] as AnyObject?) { @@ -1190,7 +1162,6 @@ class Decoders { // Decoder for User Decoders.addDecoder(clazz: User.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in if let sourceDictionary = source as? [AnyHashable: Any] { - let result = instance == nil ? User() : instance as! User switch Decoders.decodeOptional(clazz: Int64.self, source: sourceDictionary["id"] as AnyObject?) { diff --git a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/AdditionalPropertiesClass.swift b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/AdditionalPropertiesClass.swift index 1d597c725421..841becdb238b 100644 --- a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/AdditionalPropertiesClass.swift +++ b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/AdditionalPropertiesClass.swift @@ -9,6 +9,7 @@ import Foundation open class AdditionalPropertiesClass: JSONEncodable { + public var mapProperty: [String:String]? public var mapOfMapProperty: [String:[String:String]]? @@ -19,6 +20,7 @@ open class AdditionalPropertiesClass: JSONEncodable { var nillableDictionary = [String:Any?]() nillableDictionary["map_property"] = self.mapProperty?.encodeToJSON() nillableDictionary["map_of_map_property"] = self.mapOfMapProperty?.encodeToJSON() + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/Animal.swift b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/Animal.swift index bcb5136be44a..057ab8e803e4 100644 --- a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/Animal.swift +++ b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/Animal.swift @@ -9,6 +9,7 @@ import Foundation open class Animal: JSONEncodable { + public var className: String? public var color: String? @@ -19,6 +20,7 @@ open class Animal: JSONEncodable { var nillableDictionary = [String:Any?]() nillableDictionary["className"] = self.className nillableDictionary["color"] = self.color + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/ApiResponse.swift b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/ApiResponse.swift index 20aaed5294cd..c95f95c7afaa 100644 --- a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/ApiResponse.swift +++ b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/ApiResponse.swift @@ -9,6 +9,7 @@ import Foundation open class ApiResponse: JSONEncodable { + public var code: Int32? public var type: String? public var message: String? @@ -21,6 +22,7 @@ open class ApiResponse: JSONEncodable { nillableDictionary["code"] = self.code?.encodeToJSON() nillableDictionary["type"] = self.type nillableDictionary["message"] = self.message + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/ArrayOfArrayOfNumberOnly.swift b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/ArrayOfArrayOfNumberOnly.swift index 6a549ca866b5..f10815e48289 100644 --- a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/ArrayOfArrayOfNumberOnly.swift +++ b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/ArrayOfArrayOfNumberOnly.swift @@ -9,6 +9,7 @@ import Foundation open class ArrayOfArrayOfNumberOnly: JSONEncodable { + public var arrayArrayNumber: [[Double]]? public init() {} @@ -17,6 +18,7 @@ open class ArrayOfArrayOfNumberOnly: JSONEncodable { open func encodeToJSON() -> Any { var nillableDictionary = [String:Any?]() nillableDictionary["ArrayArrayNumber"] = self.arrayArrayNumber?.encodeToJSON() + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/ArrayOfNumberOnly.swift b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/ArrayOfNumberOnly.swift index 01ebd614c103..d8a77858c973 100644 --- a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/ArrayOfNumberOnly.swift +++ b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/ArrayOfNumberOnly.swift @@ -9,6 +9,7 @@ import Foundation open class ArrayOfNumberOnly: JSONEncodable { + public var arrayNumber: [Double]? public init() {} @@ -17,6 +18,7 @@ open class ArrayOfNumberOnly: JSONEncodable { open func encodeToJSON() -> Any { var nillableDictionary = [String:Any?]() nillableDictionary["ArrayNumber"] = self.arrayNumber?.encodeToJSON() + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/ArrayTest.swift b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/ArrayTest.swift index e344f141f809..a46bb27cacba 100644 --- a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/ArrayTest.swift +++ b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/ArrayTest.swift @@ -9,6 +9,7 @@ import Foundation open class ArrayTest: JSONEncodable { + public var arrayOfString: [String]? public var arrayArrayOfInteger: [[Int64]]? public var arrayArrayOfModel: [[ReadOnlyFirst]]? @@ -21,6 +22,7 @@ open class ArrayTest: JSONEncodable { nillableDictionary["array_of_string"] = self.arrayOfString?.encodeToJSON() nillableDictionary["array_array_of_integer"] = self.arrayArrayOfInteger?.encodeToJSON() nillableDictionary["array_array_of_model"] = self.arrayArrayOfModel?.encodeToJSON() + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/Capitalization.swift b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/Capitalization.swift index eee1085a69c3..54707831d7a8 100644 --- a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/Capitalization.swift +++ b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/Capitalization.swift @@ -9,6 +9,7 @@ import Foundation open class Capitalization: JSONEncodable { + public var smallCamel: String? public var capitalCamel: String? public var smallSnake: String? @@ -28,6 +29,7 @@ open class Capitalization: JSONEncodable { nillableDictionary["Capital_Snake"] = self.capitalSnake nillableDictionary["SCA_ETH_Flow_Points"] = self.sCAETHFlowPoints nillableDictionary["ATT_NAME"] = self.ATT_NAME + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/Cat.swift b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/Cat.swift index 9c714f8e9fcd..6bfbfe267b51 100644 --- a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/Cat.swift +++ b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/Cat.swift @@ -9,6 +9,7 @@ import Foundation open class Cat: Animal { + public var declawed: Bool? @@ -17,6 +18,7 @@ open class Cat: Animal { override open func encodeToJSON() -> Any { var nillableDictionary = super.encodeToJSON() as? [String:Any?] ?? [String:Any?]() nillableDictionary["declawed"] = self.declawed + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/Category.swift b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/Category.swift index 8f97c2b302bf..ed9bbc41ee08 100644 --- a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/Category.swift +++ b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/Category.swift @@ -9,6 +9,7 @@ import Foundation open class Category: JSONEncodable { + public var id: Int64? public var name: String? @@ -19,6 +20,7 @@ open class Category: JSONEncodable { var nillableDictionary = [String:Any?]() nillableDictionary["id"] = self.id?.encodeToJSON() nillableDictionary["name"] = self.name + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/ClassModel.swift b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/ClassModel.swift index a34c950a19e8..33f610c373af 100644 --- a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/ClassModel.swift +++ b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/ClassModel.swift @@ -10,6 +10,7 @@ import Foundation /** Model for testing model with \"_class\" property */ open class ClassModel: JSONEncodable { + public var _class: String? public init() {} @@ -18,6 +19,7 @@ open class ClassModel: JSONEncodable { open func encodeToJSON() -> Any { var nillableDictionary = [String:Any?]() nillableDictionary["_class"] = self._class + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/Client.swift b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/Client.swift index 9b2a4ab22047..adbe50b416da 100644 --- a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/Client.swift +++ b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/Client.swift @@ -9,6 +9,7 @@ import Foundation open class Client: JSONEncodable { + public var client: String? public init() {} @@ -17,6 +18,7 @@ open class Client: JSONEncodable { open func encodeToJSON() -> Any { var nillableDictionary = [String:Any?]() nillableDictionary["client"] = self.client + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/Dog.swift b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/Dog.swift index 7ce0453b30ff..1df72ce1283d 100644 --- a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/Dog.swift +++ b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/Dog.swift @@ -9,6 +9,7 @@ import Foundation open class Dog: Animal { + public var breed: String? @@ -17,6 +18,7 @@ open class Dog: Animal { override open func encodeToJSON() -> Any { var nillableDictionary = super.encodeToJSON() as? [String:Any?] ?? [String:Any?]() nillableDictionary["breed"] = self.breed + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/EnumArrays.swift b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/EnumArrays.swift index 1f40cde52f37..b54a5df9d767 100644 --- a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/EnumArrays.swift +++ b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/EnumArrays.swift @@ -9,6 +9,7 @@ import Foundation open class EnumArrays: JSONEncodable { + public enum JustSymbol: String { case greaterThanOrEqualTo = ">=" case dollar = "$" @@ -27,6 +28,7 @@ open class EnumArrays: JSONEncodable { var nillableDictionary = [String:Any?]() nillableDictionary["just_symbol"] = self.justSymbol?.rawValue nillableDictionary["array_enum"] = self.arrayEnum?.map({$0.rawValue}).encodeToJSON() + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/EnumTest.swift b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/EnumTest.swift index 40f2f5d3aa88..4eb4f0f5842f 100644 --- a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/EnumTest.swift +++ b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/EnumTest.swift @@ -9,6 +9,7 @@ import Foundation open class EnumTest: JSONEncodable { + public enum EnumString: String { case upper = "UPPER" case lower = "lower" @@ -36,6 +37,7 @@ open class EnumTest: JSONEncodable { nillableDictionary["enum_integer"] = self.enumInteger?.rawValue nillableDictionary["enum_number"] = self.enumNumber?.rawValue nillableDictionary["outerEnum"] = self.outerEnum?.encodeToJSON() + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/FormatTest.swift b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/FormatTest.swift index bdd5b678ba29..1a3b2ef11347 100644 --- a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/FormatTest.swift +++ b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/FormatTest.swift @@ -9,6 +9,7 @@ import Foundation open class FormatTest: JSONEncodable { + public var integer: Int32? public var int32: Int32? public var int64: Int64? @@ -41,6 +42,7 @@ open class FormatTest: JSONEncodable { nillableDictionary["dateTime"] = self.dateTime?.encodeToJSON() nillableDictionary["uuid"] = self.uuid?.encodeToJSON() nillableDictionary["password"] = self.password + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/HasOnlyReadOnly.swift b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/HasOnlyReadOnly.swift index 4364dbaf776f..35de18afb7ab 100644 --- a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/HasOnlyReadOnly.swift +++ b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/HasOnlyReadOnly.swift @@ -9,6 +9,7 @@ import Foundation open class HasOnlyReadOnly: JSONEncodable { + public var bar: String? public var foo: String? @@ -19,6 +20,7 @@ open class HasOnlyReadOnly: JSONEncodable { var nillableDictionary = [String:Any?]() nillableDictionary["bar"] = self.bar nillableDictionary["foo"] = self.foo + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/List.swift b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/List.swift index 7ce9ff47d4e4..03427b57091a 100644 --- a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/List.swift +++ b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/List.swift @@ -9,6 +9,7 @@ import Foundation open class List: JSONEncodable { + public var _123List: String? public init() {} @@ -17,6 +18,7 @@ open class List: JSONEncodable { open func encodeToJSON() -> Any { var nillableDictionary = [String:Any?]() nillableDictionary["123-list"] = self._123List + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/MapTest.swift b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/MapTest.swift index 0880b687148d..d4fefbc417b9 100644 --- a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/MapTest.swift +++ b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/MapTest.swift @@ -9,6 +9,7 @@ import Foundation open class MapTest: JSONEncodable { + public enum MapOfEnumString: String { case upper = "UPPER" case lower = "lower" @@ -22,6 +23,7 @@ open class MapTest: JSONEncodable { open func encodeToJSON() -> Any { var nillableDictionary = [String:Any?]() nillableDictionary["map_map_of_string"] = self.mapMapOfString?.encodeToJSON()//TODO: handle enum map scenario + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/MixedPropertiesAndAdditionalPropertiesClass.swift b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/MixedPropertiesAndAdditionalPropertiesClass.swift index a917131883ab..a738b2218e2b 100644 --- a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/MixedPropertiesAndAdditionalPropertiesClass.swift +++ b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/MixedPropertiesAndAdditionalPropertiesClass.swift @@ -9,6 +9,7 @@ import Foundation open class MixedPropertiesAndAdditionalPropertiesClass: JSONEncodable { + public var uuid: UUID? public var dateTime: Date? public var map: [String:Animal]? @@ -21,6 +22,7 @@ open class MixedPropertiesAndAdditionalPropertiesClass: JSONEncodable { nillableDictionary["uuid"] = self.uuid?.encodeToJSON() nillableDictionary["dateTime"] = self.dateTime?.encodeToJSON() nillableDictionary["map"] = self.map?.encodeToJSON() + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/Model200Response.swift b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/Model200Response.swift index 3dcd6b09dc9e..d31ca62f3b11 100644 --- a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/Model200Response.swift +++ b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/Model200Response.swift @@ -10,6 +10,7 @@ import Foundation /** Model for testing model name starting with number */ open class Model200Response: JSONEncodable { + public var name: Int32? public var _class: String? @@ -20,6 +21,7 @@ open class Model200Response: JSONEncodable { var nillableDictionary = [String:Any?]() nillableDictionary["name"] = self.name?.encodeToJSON() nillableDictionary["class"] = self._class + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/Name.swift b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/Name.swift index 9a271bdf8da4..50430f5f45ff 100644 --- a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/Name.swift +++ b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/Name.swift @@ -10,6 +10,7 @@ import Foundation /** Model for testing model name same as property name */ open class Name: JSONEncodable { + public var name: Int32? public var snakeCase: Int32? public var property: String? @@ -24,6 +25,7 @@ open class Name: JSONEncodable { nillableDictionary["snake_case"] = self.snakeCase?.encodeToJSON() nillableDictionary["property"] = self.property nillableDictionary["123Number"] = self._123Number?.encodeToJSON() + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/NumberOnly.swift b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/NumberOnly.swift index f1e50d03ed12..842cc740daf1 100644 --- a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/NumberOnly.swift +++ b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/NumberOnly.swift @@ -9,6 +9,7 @@ import Foundation open class NumberOnly: JSONEncodable { + public var justNumber: Double? public init() {} @@ -17,6 +18,7 @@ open class NumberOnly: JSONEncodable { open func encodeToJSON() -> Any { var nillableDictionary = [String:Any?]() nillableDictionary["JustNumber"] = self.justNumber + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/Order.swift b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/Order.swift index 3eb64b90959f..3d43e79c92b8 100644 --- a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/Order.swift +++ b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/Order.swift @@ -9,6 +9,7 @@ import Foundation open class Order: JSONEncodable { + public enum Status: String { case placed = "placed" case approved = "approved" @@ -33,6 +34,7 @@ open class Order: JSONEncodable { nillableDictionary["shipDate"] = self.shipDate?.encodeToJSON() nillableDictionary["status"] = self.status?.rawValue nillableDictionary["complete"] = self.complete + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/Pet.swift b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/Pet.swift index 08d61de5ab47..0492ac800f3d 100644 --- a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/Pet.swift +++ b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/Pet.swift @@ -9,6 +9,7 @@ import Foundation open class Pet: JSONEncodable { + public enum Status: String { case available = "available" case pending = "pending" @@ -33,6 +34,7 @@ open class Pet: JSONEncodable { nillableDictionary["photoUrls"] = self.photoUrls?.encodeToJSON() nillableDictionary["tags"] = self.tags?.encodeToJSON() nillableDictionary["status"] = self.status?.rawValue + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/ReadOnlyFirst.swift b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/ReadOnlyFirst.swift index 00cabfb0859e..91d93e166b19 100644 --- a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/ReadOnlyFirst.swift +++ b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/ReadOnlyFirst.swift @@ -9,6 +9,7 @@ import Foundation open class ReadOnlyFirst: JSONEncodable { + public var bar: String? public var baz: String? @@ -19,6 +20,7 @@ open class ReadOnlyFirst: JSONEncodable { var nillableDictionary = [String:Any?]() nillableDictionary["bar"] = self.bar nillableDictionary["baz"] = self.baz + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/Return.swift b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/Return.swift index f7e490008bc4..dcffb177a6ad 100644 --- a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/Return.swift +++ b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/Return.swift @@ -10,6 +10,7 @@ import Foundation /** Model for testing reserved words */ open class Return: JSONEncodable { + public var _return: Int32? public init() {} @@ -18,6 +19,7 @@ open class Return: JSONEncodable { open func encodeToJSON() -> Any { var nillableDictionary = [String:Any?]() nillableDictionary["return"] = self._return?.encodeToJSON() + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/SpecialModelName.swift b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/SpecialModelName.swift index 9c84a306acbf..86317fcc6f2d 100644 --- a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/SpecialModelName.swift +++ b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/SpecialModelName.swift @@ -9,6 +9,7 @@ import Foundation open class SpecialModelName: JSONEncodable { + public var specialPropertyName: Int64? public init() {} @@ -17,6 +18,7 @@ open class SpecialModelName: JSONEncodable { open func encodeToJSON() -> Any { var nillableDictionary = [String:Any?]() nillableDictionary["$special[property.name]"] = self.specialPropertyName?.encodeToJSON() + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/Tag.swift b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/Tag.swift index e175e5aac350..a66bc4b484fb 100644 --- a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/Tag.swift +++ b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/Tag.swift @@ -9,6 +9,7 @@ import Foundation open class Tag: JSONEncodable { + public var id: Int64? public var name: String? @@ -19,6 +20,7 @@ open class Tag: JSONEncodable { var nillableDictionary = [String:Any?]() nillableDictionary["id"] = self.id?.encodeToJSON() nillableDictionary["name"] = self.name + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/User.swift b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/User.swift index c3887ebffc6f..ae54b81e80f3 100644 --- a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/User.swift +++ b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/User.swift @@ -9,6 +9,7 @@ import Foundation open class User: JSONEncodable { + public var id: Int64? public var username: String? public var firstName: String? @@ -32,6 +33,7 @@ open class User: JSONEncodable { nillableDictionary["password"] = self.password nillableDictionary["phone"] = self.phone nillableDictionary["userStatus"] = self.userStatus?.encodeToJSON() + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/typescript-angular2/default/api/pet.service.ts b/samples/client/petstore/typescript-angular2/default/api/pet.service.ts index 7f89ba3b3900..5992daeeba09 100644 --- a/samples/client/petstore/typescript-angular2/default/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular2/default/api/pet.service.ts @@ -240,9 +240,8 @@ export class PetService { headers: headers, body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 search: queryParameters, - withCredentials:true + withCredentials:this.configuration.withCredentials }); - // https://github.com/swagger-api/swagger-codegen/issues/4037 if (extraHttpRequestParams) { requestOptions = (Object).assign(requestOptions, extraHttpRequestParams); @@ -291,9 +290,8 @@ export class PetService { method: RequestMethod.Delete, headers: headers, search: queryParameters, - withCredentials:true + withCredentials:this.configuration.withCredentials }); - // https://github.com/swagger-api/swagger-codegen/issues/4037 if (extraHttpRequestParams) { requestOptions = (Object).assign(requestOptions, extraHttpRequestParams); @@ -340,9 +338,8 @@ export class PetService { method: RequestMethod.Get, headers: headers, search: queryParameters, - withCredentials:true + withCredentials:this.configuration.withCredentials }); - // https://github.com/swagger-api/swagger-codegen/issues/4037 if (extraHttpRequestParams) { requestOptions = (Object).assign(requestOptions, extraHttpRequestParams); @@ -389,9 +386,8 @@ export class PetService { method: RequestMethod.Get, headers: headers, search: queryParameters, - withCredentials:true + withCredentials:this.configuration.withCredentials }); - // https://github.com/swagger-api/swagger-codegen/issues/4037 if (extraHttpRequestParams) { requestOptions = (Object).assign(requestOptions, extraHttpRequestParams); @@ -423,6 +419,11 @@ export class PetService { 'application/xml' ]; + // authentication (api_key) required + if (this.configuration.apiKeys["api_key"]) { + headers.set('api_key', this.configuration.apiKeys["api_key"]); + } + // authentication (petstore_auth) required // oauth required if (this.configuration.accessToken) { @@ -432,19 +433,13 @@ export class PetService { headers.set('Authorization', 'Bearer ' + accessToken); } - // authentication (api_key) required - if (this.configuration.apiKeys["api_key"]) { - headers.set('api_key', this.configuration.apiKeys["api_key"]); - } - let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Get, headers: headers, search: queryParameters, - withCredentials:true + withCredentials:this.configuration.withCredentials }); - // https://github.com/swagger-api/swagger-codegen/issues/4037 if (extraHttpRequestParams) { requestOptions = (Object).assign(requestOptions, extraHttpRequestParams); @@ -488,9 +483,8 @@ export class PetService { headers: headers, body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 search: queryParameters, - withCredentials:true + withCredentials:this.configuration.withCredentials }); - // https://github.com/swagger-api/swagger-codegen/issues/4037 if (extraHttpRequestParams) { requestOptions = (Object).assign(requestOptions, extraHttpRequestParams); @@ -556,9 +550,8 @@ export class PetService { headers: headers, body: formParams.toString(), search: queryParameters, - withCredentials:true + withCredentials:this.configuration.withCredentials }); - // https://github.com/swagger-api/swagger-codegen/issues/4037 if (extraHttpRequestParams) { requestOptions = (Object).assign(requestOptions, extraHttpRequestParams); @@ -625,9 +618,8 @@ export class PetService { headers: headers, body: formParams.toString(), search: queryParameters, - withCredentials:true + withCredentials:this.configuration.withCredentials }); - // https://github.com/swagger-api/swagger-codegen/issues/4037 if (extraHttpRequestParams) { requestOptions = (Object).assign(requestOptions, extraHttpRequestParams); diff --git a/samples/client/petstore/typescript-angular2/default/api/store.service.ts b/samples/client/petstore/typescript-angular2/default/api/store.service.ts index fc49f7eb64ae..89753a51efe0 100644 --- a/samples/client/petstore/typescript-angular2/default/api/store.service.ts +++ b/samples/client/petstore/typescript-angular2/default/api/store.service.ts @@ -163,9 +163,8 @@ export class StoreService { method: RequestMethod.Delete, headers: headers, search: queryParameters, - withCredentials:true + withCredentials:this.configuration.withCredentials }); - // https://github.com/swagger-api/swagger-codegen/issues/4037 if (extraHttpRequestParams) { requestOptions = (Object).assign(requestOptions, extraHttpRequestParams); @@ -201,9 +200,8 @@ export class StoreService { method: RequestMethod.Get, headers: headers, search: queryParameters, - withCredentials:true + withCredentials:this.configuration.withCredentials }); - // https://github.com/swagger-api/swagger-codegen/issues/4037 if (extraHttpRequestParams) { requestOptions = (Object).assign(requestOptions, extraHttpRequestParams); @@ -240,9 +238,8 @@ export class StoreService { method: RequestMethod.Get, headers: headers, search: queryParameters, - withCredentials:true + withCredentials:this.configuration.withCredentials }); - // https://github.com/swagger-api/swagger-codegen/issues/4037 if (extraHttpRequestParams) { requestOptions = (Object).assign(requestOptions, extraHttpRequestParams); @@ -277,9 +274,8 @@ export class StoreService { headers: headers, body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 search: queryParameters, - withCredentials:true + withCredentials:this.configuration.withCredentials }); - // https://github.com/swagger-api/swagger-codegen/issues/4037 if (extraHttpRequestParams) { requestOptions = (Object).assign(requestOptions, extraHttpRequestParams); diff --git a/samples/client/petstore/typescript-angular2/default/api/user.service.ts b/samples/client/petstore/typescript-angular2/default/api/user.service.ts index 26eeda66a2db..a5aa4962399e 100644 --- a/samples/client/petstore/typescript-angular2/default/api/user.service.ts +++ b/samples/client/petstore/typescript-angular2/default/api/user.service.ts @@ -227,9 +227,8 @@ export class UserService { headers: headers, body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 search: queryParameters, - withCredentials:true + withCredentials:this.configuration.withCredentials }); - // https://github.com/swagger-api/swagger-codegen/issues/4037 if (extraHttpRequestParams) { requestOptions = (Object).assign(requestOptions, extraHttpRequestParams); @@ -264,9 +263,8 @@ export class UserService { headers: headers, body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 search: queryParameters, - withCredentials:true + withCredentials:this.configuration.withCredentials }); - // https://github.com/swagger-api/swagger-codegen/issues/4037 if (extraHttpRequestParams) { requestOptions = (Object).assign(requestOptions, extraHttpRequestParams); @@ -301,9 +299,8 @@ export class UserService { headers: headers, body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 search: queryParameters, - withCredentials:true + withCredentials:this.configuration.withCredentials }); - // https://github.com/swagger-api/swagger-codegen/issues/4037 if (extraHttpRequestParams) { requestOptions = (Object).assign(requestOptions, extraHttpRequestParams); @@ -340,9 +337,8 @@ export class UserService { method: RequestMethod.Delete, headers: headers, search: queryParameters, - withCredentials:true + withCredentials:this.configuration.withCredentials }); - // https://github.com/swagger-api/swagger-codegen/issues/4037 if (extraHttpRequestParams) { requestOptions = (Object).assign(requestOptions, extraHttpRequestParams); @@ -379,9 +375,8 @@ export class UserService { method: RequestMethod.Get, headers: headers, search: queryParameters, - withCredentials:true + withCredentials:this.configuration.withCredentials }); - // https://github.com/swagger-api/swagger-codegen/issues/4037 if (extraHttpRequestParams) { requestOptions = (Object).assign(requestOptions, extraHttpRequestParams); @@ -422,9 +417,8 @@ export class UserService { method: RequestMethod.Get, headers: headers, search: queryParameters, - withCredentials:true + withCredentials:this.configuration.withCredentials }); - // https://github.com/swagger-api/swagger-codegen/issues/4037 if (extraHttpRequestParams) { requestOptions = (Object).assign(requestOptions, extraHttpRequestParams); @@ -455,9 +449,8 @@ export class UserService { method: RequestMethod.Get, headers: headers, search: queryParameters, - withCredentials:true + withCredentials:this.configuration.withCredentials }); - // https://github.com/swagger-api/swagger-codegen/issues/4037 if (extraHttpRequestParams) { requestOptions = (Object).assign(requestOptions, extraHttpRequestParams); @@ -498,9 +491,8 @@ export class UserService { headers: headers, body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 search: queryParameters, - withCredentials:true + withCredentials:this.configuration.withCredentials }); - // https://github.com/swagger-api/swagger-codegen/issues/4037 if (extraHttpRequestParams) { requestOptions = (Object).assign(requestOptions, extraHttpRequestParams); diff --git a/samples/client/petstore/typescript-angular2/default/configuration.ts b/samples/client/petstore/typescript-angular2/default/configuration.ts index df90b4829bbb..0eed43fd575a 100644 --- a/samples/client/petstore/typescript-angular2/default/configuration.ts +++ b/samples/client/petstore/typescript-angular2/default/configuration.ts @@ -1,24 +1,26 @@ export interface ConfigurationParameters { - apiKeys?: {[ key: string ]: string}; - username?: string; - password?: string; - accessToken?: string; - basePath?: string; + apiKeys?: {[ key: string ]: string}; + username?: string; + password?: string; + accessToken?: string; + basePath?: string; + withCredentials?: boolean; } export class Configuration { - apiKeys: {[ key: string ]: string}; - username: string; - password: string; - accessToken: string | (() => string); - basePath: string; + apiKeys: {[ key: string ]: string}; + username: string; + password: string; + accessToken: string | (() => string); + basePath: string; + withCredentials: boolean; - - constructor(configurationParameters: ConfigurationParameters = {}) { - this.apiKeys = configurationParameters.apiKeys; - this.username = configurationParameters.username; - this.password = configurationParameters.password; - this.accessToken = configurationParameters.accessToken; - this.basePath = configurationParameters.basePath; - } + constructor(configurationParameters: ConfigurationParameters = {}) { + this.apiKeys = configurationParameters.apiKeys; + this.username = configurationParameters.username; + this.password = configurationParameters.password; + this.accessToken = configurationParameters.accessToken; + this.basePath = configurationParameters.basePath; + this.withCredentials = configurationParameters.withCredentials; + } } diff --git a/samples/client/petstore/typescript-angular2/npm/README.md b/samples/client/petstore/typescript-angular2/npm/README.md index e92ce8bb979b..fbf37be47b03 100644 --- a/samples/client/petstore/typescript-angular2/npm/README.md +++ b/samples/client/petstore/typescript-angular2/npm/README.md @@ -1,4 +1,4 @@ -## @swagger/angular2-typescript-petstore@0.0.1-SNAPSHOT.201704231845 +## @swagger/angular2-typescript-petstore@0.0.1 ### Building @@ -19,7 +19,7 @@ navigate to the folder of your consuming project and run one of next commando's. _published:_ ``` -npm install @swagger/angular2-typescript-petstore@0.0.1-SNAPSHOT.201704231845 --save +npm install @swagger/angular2-typescript-petstore@0.0.1 --save ``` _unPublished (not recommended):_ diff --git a/samples/client/petstore/typescript-angular2/npm/api/pet.service.ts b/samples/client/petstore/typescript-angular2/npm/api/pet.service.ts index 7f89ba3b3900..5992daeeba09 100644 --- a/samples/client/petstore/typescript-angular2/npm/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular2/npm/api/pet.service.ts @@ -240,9 +240,8 @@ export class PetService { headers: headers, body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 search: queryParameters, - withCredentials:true + withCredentials:this.configuration.withCredentials }); - // https://github.com/swagger-api/swagger-codegen/issues/4037 if (extraHttpRequestParams) { requestOptions = (Object).assign(requestOptions, extraHttpRequestParams); @@ -291,9 +290,8 @@ export class PetService { method: RequestMethod.Delete, headers: headers, search: queryParameters, - withCredentials:true + withCredentials:this.configuration.withCredentials }); - // https://github.com/swagger-api/swagger-codegen/issues/4037 if (extraHttpRequestParams) { requestOptions = (Object).assign(requestOptions, extraHttpRequestParams); @@ -340,9 +338,8 @@ export class PetService { method: RequestMethod.Get, headers: headers, search: queryParameters, - withCredentials:true + withCredentials:this.configuration.withCredentials }); - // https://github.com/swagger-api/swagger-codegen/issues/4037 if (extraHttpRequestParams) { requestOptions = (Object).assign(requestOptions, extraHttpRequestParams); @@ -389,9 +386,8 @@ export class PetService { method: RequestMethod.Get, headers: headers, search: queryParameters, - withCredentials:true + withCredentials:this.configuration.withCredentials }); - // https://github.com/swagger-api/swagger-codegen/issues/4037 if (extraHttpRequestParams) { requestOptions = (Object).assign(requestOptions, extraHttpRequestParams); @@ -423,6 +419,11 @@ export class PetService { 'application/xml' ]; + // authentication (api_key) required + if (this.configuration.apiKeys["api_key"]) { + headers.set('api_key', this.configuration.apiKeys["api_key"]); + } + // authentication (petstore_auth) required // oauth required if (this.configuration.accessToken) { @@ -432,19 +433,13 @@ export class PetService { headers.set('Authorization', 'Bearer ' + accessToken); } - // authentication (api_key) required - if (this.configuration.apiKeys["api_key"]) { - headers.set('api_key', this.configuration.apiKeys["api_key"]); - } - let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Get, headers: headers, search: queryParameters, - withCredentials:true + withCredentials:this.configuration.withCredentials }); - // https://github.com/swagger-api/swagger-codegen/issues/4037 if (extraHttpRequestParams) { requestOptions = (Object).assign(requestOptions, extraHttpRequestParams); @@ -488,9 +483,8 @@ export class PetService { headers: headers, body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 search: queryParameters, - withCredentials:true + withCredentials:this.configuration.withCredentials }); - // https://github.com/swagger-api/swagger-codegen/issues/4037 if (extraHttpRequestParams) { requestOptions = (Object).assign(requestOptions, extraHttpRequestParams); @@ -556,9 +550,8 @@ export class PetService { headers: headers, body: formParams.toString(), search: queryParameters, - withCredentials:true + withCredentials:this.configuration.withCredentials }); - // https://github.com/swagger-api/swagger-codegen/issues/4037 if (extraHttpRequestParams) { requestOptions = (Object).assign(requestOptions, extraHttpRequestParams); @@ -625,9 +618,8 @@ export class PetService { headers: headers, body: formParams.toString(), search: queryParameters, - withCredentials:true + withCredentials:this.configuration.withCredentials }); - // https://github.com/swagger-api/swagger-codegen/issues/4037 if (extraHttpRequestParams) { requestOptions = (Object).assign(requestOptions, extraHttpRequestParams); diff --git a/samples/client/petstore/typescript-angular2/npm/api/store.service.ts b/samples/client/petstore/typescript-angular2/npm/api/store.service.ts index fc49f7eb64ae..89753a51efe0 100644 --- a/samples/client/petstore/typescript-angular2/npm/api/store.service.ts +++ b/samples/client/petstore/typescript-angular2/npm/api/store.service.ts @@ -163,9 +163,8 @@ export class StoreService { method: RequestMethod.Delete, headers: headers, search: queryParameters, - withCredentials:true + withCredentials:this.configuration.withCredentials }); - // https://github.com/swagger-api/swagger-codegen/issues/4037 if (extraHttpRequestParams) { requestOptions = (Object).assign(requestOptions, extraHttpRequestParams); @@ -201,9 +200,8 @@ export class StoreService { method: RequestMethod.Get, headers: headers, search: queryParameters, - withCredentials:true + withCredentials:this.configuration.withCredentials }); - // https://github.com/swagger-api/swagger-codegen/issues/4037 if (extraHttpRequestParams) { requestOptions = (Object).assign(requestOptions, extraHttpRequestParams); @@ -240,9 +238,8 @@ export class StoreService { method: RequestMethod.Get, headers: headers, search: queryParameters, - withCredentials:true + withCredentials:this.configuration.withCredentials }); - // https://github.com/swagger-api/swagger-codegen/issues/4037 if (extraHttpRequestParams) { requestOptions = (Object).assign(requestOptions, extraHttpRequestParams); @@ -277,9 +274,8 @@ export class StoreService { headers: headers, body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 search: queryParameters, - withCredentials:true + withCredentials:this.configuration.withCredentials }); - // https://github.com/swagger-api/swagger-codegen/issues/4037 if (extraHttpRequestParams) { requestOptions = (Object).assign(requestOptions, extraHttpRequestParams); diff --git a/samples/client/petstore/typescript-angular2/npm/api/user.service.ts b/samples/client/petstore/typescript-angular2/npm/api/user.service.ts index 26eeda66a2db..a5aa4962399e 100644 --- a/samples/client/petstore/typescript-angular2/npm/api/user.service.ts +++ b/samples/client/petstore/typescript-angular2/npm/api/user.service.ts @@ -227,9 +227,8 @@ export class UserService { headers: headers, body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 search: queryParameters, - withCredentials:true + withCredentials:this.configuration.withCredentials }); - // https://github.com/swagger-api/swagger-codegen/issues/4037 if (extraHttpRequestParams) { requestOptions = (Object).assign(requestOptions, extraHttpRequestParams); @@ -264,9 +263,8 @@ export class UserService { headers: headers, body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 search: queryParameters, - withCredentials:true + withCredentials:this.configuration.withCredentials }); - // https://github.com/swagger-api/swagger-codegen/issues/4037 if (extraHttpRequestParams) { requestOptions = (Object).assign(requestOptions, extraHttpRequestParams); @@ -301,9 +299,8 @@ export class UserService { headers: headers, body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 search: queryParameters, - withCredentials:true + withCredentials:this.configuration.withCredentials }); - // https://github.com/swagger-api/swagger-codegen/issues/4037 if (extraHttpRequestParams) { requestOptions = (Object).assign(requestOptions, extraHttpRequestParams); @@ -340,9 +337,8 @@ export class UserService { method: RequestMethod.Delete, headers: headers, search: queryParameters, - withCredentials:true + withCredentials:this.configuration.withCredentials }); - // https://github.com/swagger-api/swagger-codegen/issues/4037 if (extraHttpRequestParams) { requestOptions = (Object).assign(requestOptions, extraHttpRequestParams); @@ -379,9 +375,8 @@ export class UserService { method: RequestMethod.Get, headers: headers, search: queryParameters, - withCredentials:true + withCredentials:this.configuration.withCredentials }); - // https://github.com/swagger-api/swagger-codegen/issues/4037 if (extraHttpRequestParams) { requestOptions = (Object).assign(requestOptions, extraHttpRequestParams); @@ -422,9 +417,8 @@ export class UserService { method: RequestMethod.Get, headers: headers, search: queryParameters, - withCredentials:true + withCredentials:this.configuration.withCredentials }); - // https://github.com/swagger-api/swagger-codegen/issues/4037 if (extraHttpRequestParams) { requestOptions = (Object).assign(requestOptions, extraHttpRequestParams); @@ -455,9 +449,8 @@ export class UserService { method: RequestMethod.Get, headers: headers, search: queryParameters, - withCredentials:true + withCredentials:this.configuration.withCredentials }); - // https://github.com/swagger-api/swagger-codegen/issues/4037 if (extraHttpRequestParams) { requestOptions = (Object).assign(requestOptions, extraHttpRequestParams); @@ -498,9 +491,8 @@ export class UserService { headers: headers, body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 search: queryParameters, - withCredentials:true + withCredentials:this.configuration.withCredentials }); - // https://github.com/swagger-api/swagger-codegen/issues/4037 if (extraHttpRequestParams) { requestOptions = (Object).assign(requestOptions, extraHttpRequestParams); diff --git a/samples/client/petstore/typescript-angular2/npm/configuration.ts b/samples/client/petstore/typescript-angular2/npm/configuration.ts index df90b4829bbb..0eed43fd575a 100644 --- a/samples/client/petstore/typescript-angular2/npm/configuration.ts +++ b/samples/client/petstore/typescript-angular2/npm/configuration.ts @@ -1,24 +1,26 @@ export interface ConfigurationParameters { - apiKeys?: {[ key: string ]: string}; - username?: string; - password?: string; - accessToken?: string; - basePath?: string; + apiKeys?: {[ key: string ]: string}; + username?: string; + password?: string; + accessToken?: string; + basePath?: string; + withCredentials?: boolean; } export class Configuration { - apiKeys: {[ key: string ]: string}; - username: string; - password: string; - accessToken: string | (() => string); - basePath: string; + apiKeys: {[ key: string ]: string}; + username: string; + password: string; + accessToken: string | (() => string); + basePath: string; + withCredentials: boolean; - - constructor(configurationParameters: ConfigurationParameters = {}) { - this.apiKeys = configurationParameters.apiKeys; - this.username = configurationParameters.username; - this.password = configurationParameters.password; - this.accessToken = configurationParameters.accessToken; - this.basePath = configurationParameters.basePath; - } + constructor(configurationParameters: ConfigurationParameters = {}) { + this.apiKeys = configurationParameters.apiKeys; + this.username = configurationParameters.username; + this.password = configurationParameters.password; + this.accessToken = configurationParameters.accessToken; + this.basePath = configurationParameters.basePath; + this.withCredentials = configurationParameters.withCredentials; + } } diff --git a/samples/client/petstore/typescript-angular2/npm/package.json b/samples/client/petstore/typescript-angular2/npm/package.json index 50ce3a48b59e..cca1493f9d98 100644 --- a/samples/client/petstore/typescript-angular2/npm/package.json +++ b/samples/client/petstore/typescript-angular2/npm/package.json @@ -1,6 +1,6 @@ { "name": "@swagger/angular2-typescript-petstore", - "version": "0.0.1-SNAPSHOT.201704231845", + "version": "0.0.1", "description": "swagger client for @swagger/angular2-typescript-petstore", "author": "Swagger Codegen Contributors", "keywords": [