mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-07 10:58:55 +00:00
Merge remote-tracking branch 'origin/master' into 2.3.0
This commit is contained in:
commit
413a00ef40
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
|
@ -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
|
||||
|
@ -1,4 +1,4 @@
|
||||
{
|
||||
"library": "jersey2",
|
||||
"artifactId": "swagger-petstore-jersey2"
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
{
|
||||
"library": "resteasy",
|
||||
"artifactId": "swagger-petstore-resteasy"
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
{
|
||||
"library": "resttemplate",
|
||||
"artifactId": "swagger-petstore-resttemplate"
|
||||
}
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
{"useBeanValidation":"true","enableBuilderSupport":"true","library":"retrofit2", "usePlay24WS":"true"}
|
||||
{"useBeanValidation":"true","enableBuilderSupport":"true","library":"retrofit2", "usePlay24WS":"true"}
|
||||
|
@ -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
|
||||
|
@ -2,4 +2,4 @@
|
||||
"library": "jersey2",
|
||||
"artifactId": "swagger-petstore-jersey2",
|
||||
"dateLibrary": "java8"
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -2,5 +2,5 @@
|
||||
"npmName": "@swagger/angular2-typescript-petstore",
|
||||
"npmVersion": "0.0.1",
|
||||
"npmRepository" : "https://skimdb.npmjs.com/registry",
|
||||
"snapshot" : true
|
||||
"snapshot" : false
|
||||
}
|
||||
|
@ -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%
|
||||
|
@ -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%
|
||||
|
@ -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%
|
||||
|
@ -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%
|
||||
|
@ -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%
|
||||
|
@ -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%
|
||||
|
@ -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%
|
||||
|
@ -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%
|
||||
|
@ -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%
|
||||
|
@ -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%
|
||||
|
@ -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%
|
||||
|
@ -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%
|
||||
|
@ -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%
|
||||
|
@ -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%
|
||||
|
@ -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%
|
||||
|
@ -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%
|
||||
|
@ -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%
|
||||
|
@ -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%
|
||||
|
@ -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%
|
||||
|
@ -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%
|
||||
|
@ -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%
|
||||
|
@ -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%
|
||||
|
@ -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%
|
||||
|
@ -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%
|
||||
|
@ -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%
|
||||
|
@ -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%
|
||||
|
@ -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%
|
||||
|
@ -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%
|
||||
|
@ -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%
|
||||
|
@ -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%
|
||||
|
@ -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%
|
||||
|
@ -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%
|
||||
|
@ -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%
|
||||
|
@ -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%
|
||||
|
@ -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%
|
||||
|
@ -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%
|
||||
|
@ -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%
|
||||
|
@ -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%
|
||||
|
@ -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
|
||||
);
|
||||
|
||||
|
@ -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<String> messageList = result.getMessages();
|
||||
Set<String> messages = new HashSet<String>(messageList);
|
||||
|
||||
for (String message: messages) {
|
||||
System.out.println(message);
|
||||
}
|
||||
|
||||
if (messages.size() > 0) {
|
||||
throw new ValidateException();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package io.swagger.codegen.cmd;
|
||||
|
||||
/**
|
||||
* Created by takuro on 2017/05/02.
|
||||
*/
|
||||
public class ValidateException extends RuntimeException {
|
||||
}
|
@ -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<CodegenSecurity>() {
|
||||
@Override
|
||||
public int compare(CodegenSecurity one, CodegenSecurity another) {
|
||||
return ObjectUtils.compare(one.name, another.name);
|
||||
}
|
||||
});
|
||||
// set 'hasMore'
|
||||
Iterator<CodegenSecurity> it = secs.iterator();
|
||||
while (it.hasNext()) {
|
||||
final CodegenSecurity security = it.next();
|
||||
security.hasMore = it.hasNext();
|
||||
}
|
||||
|
||||
return secs;
|
||||
}
|
||||
|
||||
|
@ -625,13 +625,6 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
|
||||
bundle.put("modelPackage", config.modelPackage());
|
||||
List<CodegenSecurity> authMethods = config.fromSecurity(swagger.getSecurityDefinitions());
|
||||
if (authMethods != null && !authMethods.isEmpty()) {
|
||||
// sort auth methods to maintain the same order
|
||||
Collections.sort(authMethods, new Comparator<CodegenSecurity>() {
|
||||
@Override
|
||||
public int compare(CodegenSecurity one, CodegenSecurity another) {
|
||||
return ObjectUtils.compare(one.name, another.name);
|
||||
}
|
||||
});
|
||||
bundle.put("authMethods", authMethods);
|
||||
bundle.put("hasAuthMethods", true);
|
||||
}
|
||||
|
@ -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<String> foundationClasses = new HashSet<String>();
|
||||
// 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<String, String> namespaces = new HashMap<String, String>();
|
||||
protected Set<String> systemIncludes = new HashSet<String>();
|
||||
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.
|
||||
|
@ -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());
|
||||
|
@ -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}}
|
||||
}
|
||||
|
||||
|
@ -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}}
|
||||
|
@ -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);
|
||||
|
@ -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}}
|
||||
|
||||
|
@ -6,6 +6,10 @@
|
||||
#include <QBuffer>
|
||||
|
||||
|
||||
{{#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}}
|
||||
|
@ -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
|
||||
|
@ -6,7 +6,10 @@
|
||||
#include <QJsonArray>
|
||||
#include <QJsonDocument>
|
||||
|
||||
namespace Swagger {
|
||||
{{#cppNamespaceDeclarations}}
|
||||
namespace {{this}} {
|
||||
{{/cppNamespaceDeclarations}}
|
||||
|
||||
{{classname}}::{{classname}}() {}
|
||||
|
||||
{{classname}}::~{{classname}}() {}
|
||||
@ -178,4 +181,7 @@ void
|
||||
}
|
||||
{{/operation}}
|
||||
{{/operations}}
|
||||
} /* namespace Swagger */
|
||||
|
||||
{{#cppNamespaceDeclarations}}
|
||||
}
|
||||
{{/cppNamespaceDeclarations}}
|
||||
|
@ -9,7 +9,9 @@
|
||||
|
||||
#include <QObject>
|
||||
|
||||
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
|
||||
|
@ -7,7 +7,10 @@
|
||||
#include <QJsonValue>
|
||||
#include <QDateTime>
|
||||
|
||||
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<SWGObject**>(value);
|
||||
@ -279,4 +282,7 @@ QString
|
||||
stringValue(bool value) {
|
||||
return QString(value ? "true" : "false");
|
||||
}
|
||||
} /* namespace Swagger */
|
||||
|
||||
{{#cppNamespaceDeclarations}}
|
||||
}
|
||||
{{/cppNamespaceDeclarations}}
|
@ -4,7 +4,10 @@
|
||||
|
||||
#include <QJsonValue>
|
||||
|
||||
namespace Swagger {
|
||||
{{#cppNamespaceDeclarations}}
|
||||
namespace {{this}} {
|
||||
{{/cppNamespaceDeclarations}}
|
||||
|
||||
void setValue(void* value, QJsonValue obj, QString type, QString complexType);
|
||||
void toJsonArray(QList<void*>* 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
|
||||
|
@ -9,8 +9,9 @@
|
||||
#include <QObject>
|
||||
#include <QDebug>
|
||||
|
||||
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}}
|
||||
|
@ -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}}
|
||||
|
@ -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}}
|
||||
|
@ -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_ */
|
||||
|
@ -4,6 +4,10 @@
|
||||
|
||||
#include <QJsonValue>
|
||||
|
||||
{{#cppNamespaceDeclarations}}
|
||||
namespace {{this}} {
|
||||
{{/cppNamespaceDeclarations}}
|
||||
|
||||
class {{prefix}}Object {
|
||||
public:
|
||||
virtual QJsonObject* asJsonObject() {
|
||||
@ -22,4 +26,8 @@ class {{prefix}}Object {
|
||||
}
|
||||
};
|
||||
|
||||
{{#cppNamespaceDeclarations}}
|
||||
}
|
||||
{{/cppNamespaceDeclarations}}
|
||||
|
||||
#endif /* _{{prefix}}_OBJECT_H_ */
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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")
|
||||
|
@ -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)"))
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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 = (<any>Object).assign(requestOptions, extraHttpRequestParams);
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -100,7 +100,7 @@ class FakeApi(object):
|
||||
|
||||
path_params = {}
|
||||
|
||||
query_params = {}
|
||||
query_params = []
|
||||
|
||||
header_params = {}
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include <QJsonDocument>
|
||||
|
||||
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 */
|
||||
|
||||
}
|
||||
|
@ -41,5 +41,6 @@ signals:
|
||||
void testCodeInject */ ' " =end \r\n \n \rSignal();
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
#endif
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include <QJsonValue>
|
||||
#include <QDateTime>
|
||||
|
||||
|
||||
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<SWGObject**>(value);
|
||||
@ -290,4 +291,5 @@ QString
|
||||
stringValue(bool value) {
|
||||
return QString(value ? "true" : "false");
|
||||
}
|
||||
} /* namespace Swagger */
|
||||
|
||||
}
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include <QJsonValue>
|
||||
|
||||
namespace Swagger {
|
||||
|
||||
void setValue(void* value, QJsonValue obj, QString type, QString complexType);
|
||||
void toJsonArray(QList<void*>* 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
|
||||
|
@ -17,6 +17,8 @@
|
||||
#include <QBuffer>
|
||||
|
||||
|
||||
namespace Swagger {
|
||||
|
||||
HttpRequestInput::HttpRequestInput() {
|
||||
initialize();
|
||||
}
|
||||
@ -309,3 +311,5 @@ void HttpRequestWorker::on_manager_finished(QNetworkReply *reply) {
|
||||
|
||||
emit on_execution_finished(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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_ */
|
||||
|
@ -15,6 +15,8 @@
|
||||
|
||||
#include <QJsonValue>
|
||||
|
||||
namespace Swagger {
|
||||
|
||||
class SWGObject {
|
||||
public:
|
||||
virtual QJsonObject* asJsonObject() {
|
||||
@ -33,4 +35,6 @@ class SWGObject {
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* _SWG_OBJECT_H_ */
|
||||
|
@ -22,7 +22,6 @@
|
||||
|
||||
namespace Swagger {
|
||||
|
||||
|
||||
SWGReturn::SWGReturn(QString* json) {
|
||||
init();
|
||||
this->fromJson(*json);
|
||||
@ -89,6 +88,5 @@ SWGReturn::setReturn(qint32 return) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
} /* namespace Swagger */
|
||||
}
|
||||
|
||||
|
@ -49,6 +49,6 @@ private:
|
||||
qint32 return;
|
||||
};
|
||||
|
||||
} /* namespace Swagger */
|
||||
}
|
||||
|
||||
#endif /* SWGReturn_H_ */
|
||||
|
@ -1 +0,0 @@
|
||||
Hello world!
|
@ -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
|
||||
|
@ -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() {
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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<String, Animal>)in.readValue(Animal.class.getClassLoader());
|
||||
}
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user